25

How can I change the Ubuntu 20.04 login screen theme or background?

In the previous version 19.10, I can change it from the CSS file under Yaru theme but now there is no CSS file.

  • 1
    The answer is to install vanilla-gnome-default-settings. This will set the GDM theme to Gnome stock, and also give you the option of continuing to use Yaru as your theme or the stock stock Gnome theme. – Caleb McKay Apr 22 at 16:45
23

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 1
go for this for complete flexibility. But risk of breaking the system if wrongly edited the contents. Of course recovery is easy also.

Workaround 2
go for this for changing login background with Image/ Color with a script.

you can download the focalgdm3 file via command line

wget -qO - https://github.com/PRATAP-KUMAR/focalgdm3/archive/TrailRun.tar.gz | tar zx --strip-components=1 focalgdm3-TrailRun/focalgdm3

Once you downloaded the script focalgdm3.

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

sudo apt install libglib2.0-dev

run the below command to set the Image as background..

sudo ./focalgdm3 /absolute/path/to/image

run the below command to set the Color as background..
(Change #aAbBcC with any valid Hex Color Code)

sudo ./focalgdm3 \#aAbBcC

to reset everything that the script made run the below command with root privileges

sudo ./focalgdm3 --reset

| improve this answer | |
  • Thanks. Will you be able to help with this thread: askubuntu.com/questions/1233580/… ? The 20.04 default log out/ power off screen had a cool blur effect with some nice icon and effects. I lost that and instead getting a dialog box. Any idea, how to restore that and choose the right setting to bring it back? – SubinR May 12 at 14:32
  • I tried Workaround 2 and specified background image path as /home/username/Pictures/mybackground.jpg but it did not appear on the login screen. On the other hand, when I saved the same image as /usr/share/backgrounds/mybackground.jpg then it was displayed as the background. – rpr Jul 28 at 16:22
  • Yes, /home/username is the path of my home directory. The problem is actually caused by the permissions of that directory: rwxrwx--- (770). The process that displays the login screen background probably runs as gdm user and so it cannot access the picture inside my home directory. – rpr Jul 28 at 18:21
  • Nice catch..... – UnKNOWn Jul 28 at 18:22
  • 1
    Thanks a lot. Workaround 2 worked. – Puspam Aug 11 at 8:24
8

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.

| improve this answer | |
  • when I tried to download the script from the link with the below command: curl -L -O github.com/thiggy01/ubuntu-20.04-change-gdm-background/raw/master/ubuntu-20.04-change-gdm-background I'm getting permission denied error! – SubinR May 12 at 13:58
  • Thanks for the post. The script already asks if you want to install libglib2.0-dev-bin. @SubinR try with wget github.com/thiggy01/ubuntu-20.04-change-gdm-background/raw/master/ubuntu-20.04-change-gdm-background. – thiggy01 May 17 at 15:28
  • this is easiest foolproof solution for Ubuntu 20.04 – Scott Stensland Jun 19 at 12:07
1

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!

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.