How do I change login screen theme or background in Ubuntu 20.04?

Solution 1:

In previous versions of Ubuntu since its introduction of gdm3 for login greeter, the style sheet file is directly available to edit.

for example:

/usr/share/gnome-shell/theme/ubuntu.css #for Ubuntu 18.04
/usr/share/gnome-shell/theme/Yaru/gnome-shell.css` #for Ubuntu 19.10

are the files being used as alternatives.

The name of alternatives is gdm3.css.

for Ubuntu 20.04 the equivalent to above is gdm3-theme.gresource

$ update-alternatives --config gdm3-theme.gresource   
There are 3 choices for the alternative gdm3-theme.gresource (providing /usr/share/gnome-shell/gdm3-theme.gresource).

  Selection    Path                                                           Priority   Status
------------------------------------------------------------
* 0            /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource   15        auto mode
  1            /usr/local/share/gnome-shell/theme/focalgdm3.gresource          0         manual mode
  2            /usr/share/gnome-shell/gnome-shell-theme.gresource              10        manual mode
  3            /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource   15        manual mode

Press <enter> to keep the current choice[*], or type selection number:

from the core files of Ubuntu, the config for gdm is

stylesheetName: 'gdm3.css',
themeResourceName: 'gdm3-theme.gresource',

the above means that one needs to edit the file gdm3.css inside the .gresource file from the above update-alternatives result. Or install some other .gresource files which have the compatibility for Ubuntu 20.04. for example in above output you have the choice of

.../gnome-shell/gnome-shell-theme.gresource

as an alternative. If you trust some other (external sources) .gresource files that have the compatibility for Ubuntu 20.04, You can install them as an alternative and use it.

If you want to edit,

for example, you can extract the gdm3.css and see the color that is configured for login screen background.

run the below commands one by one

gresource extract /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource /org/gnome/shell/theme/gdm3.css > $HOME/gdm3.css
gedit $HOME/gdm3.css

some of the content:

#lockDialogGroup {
  background-color: #4f194c; }

Editing this content with your required content and recompiling it to create new .gresource file is required. After which you can install this new .gresource file as an alternative and select it.

How to extract and compile?

Disclimer: this link is only for Idea. Proper making and configuration is required for getting things to work for Ubuntu 20.04 Otherwise system will be bricked. Please note that this post is quite older and contents vary from Ubuntu 20.04.

Also note that the package libglib2.0-dev is required to compile the .gresource file.


Well, seems the process is very heavy just for changing the login screen background, rite? what if you want to change the background Image or color of the Login screen frequently?

Workaround
for changing login background with Image/ Color/ Gradient Horizontal/Vertical with a script.

you can download the ubuntu-gdm-set-background file via command line

wget -qO - https://github.com/PRATAP-KUMAR/ubuntu-gdm-set-background/archive/main.tar.gz | tar zx --strip-components=1 ubuntu-gdm-set-background-main/ubuntu-gdm-set-background

Once you downloaded the script ubuntu-gdm-set-background.

Make sure you have installed the required package, libglib2.0-dev-bin.
If not installed, Install it with the command

sudo apt install libglib2.0-dev-bin

there are four options

background with image
background with color
background with gradient horizontal ( requires two valid hex color inputs)
background with gradient vertical ( requires two valid hex color inputs)

tip: be ready with valid hex color code in place of below example like #aAbBcC or #dDeEfF. Change them to your preferred hex color codes. you may choose colors from https://www.color-hex.com/

Example Commands:

sudo ./ubuntu-gdm-set-background --image /home/user/backgrounds/image.jpg
sudo ./ubuntu-gdm-set-background --color \#aAbBcC
sudo ./ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF
sudo ./ubuntu-gdm-set-background --gradient vertical \#aAbBcC \#dDeEfF
sudo ./ubuntu-gdm-set-background --reset
./ubuntu-gdm-set-background --help

try Ctrl+Alt+F1 to go the gdm screen to see the change.

If change does not appear, then restart gdm with below command

sudo systemctl restart gdm

Solution 2:

Easy! Just download the script from https://github.com/thiggy01/ubuntu-20.04-change-gdm-background, chmod +x the script, run like this:

First, install this package:

sudo apt install libglib2.0-dev-bin

Now, run the script:

sudo ./Scriptname picturename

To restore default background:

sudo ./Scriptname --restore

This only works on 20.04.

Solution 3:

You can use https://github.com/juhaku/loginized which is an elegant software to update GDM3 theme for Ubuntu 20.04. With this you can change gtk-theme, login screen background and screen shield wallpaper.

If you also want to change cursor-theme and icon-theme you can use gdm3setup.

Hope that helps!