Set Background for Ubuntu's (Gnome's GDM) lock/login screen!
Beyond eyecandy, this is useful for privacy: where your personal desktop background isn't revealed to those around who don't have your password.
Before running this script, first please follow this link for setting login background via gsettings
: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1929536. If you are not satisfied with the result then only go for the script.
[Test Case]
- Boot a desktop session
- Verify that the greeter shows the default aubergine background.
- Login as the administrator of the machine
- Install systemd-container
- Switch to the GDM user:
$ sudo machinectl shell gdm@ /bin/bash
- Apply a different background with the command:
$ gsettings set com.ubuntu.login-screen background-picture-uri 'file:///usr/share/backgrounds/warty-final-ubuntu.png'
- Logout
- Verify that the greeter now shows the image
warty-final-ubuntu.png
.
This is highly recommonded way: https://github.com/PRATAP-KUMAR/gdm-extension - as it avoids having to recompile gresources.
ubuntu-gdm-set-background
-> has four options just like the previous versions: Image, Color, Gradient Horizontal, Gradient Vertical.ubuntu-gdm-set-background-transparent
-> sets the login-background color transparent so that the background set viagsettings set com.ubuntu.login-screen background-picture-uri
is visible. This is the RECOMMENDED way for 23.04+.
Please follow this link for setting login background via gsettings
: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1929536
ubuntu-gdm-set-background
script (for changing Ubuntu 20.04, 21.04, 22.04, 22.10, 23.04, 23.10 GDM Background) HELP
- clone the repo
git clone https://github.com/PRATAP-KUMAR/ubuntu-gdm-set-background.git
cd ubuntu-gdm-set-background
bash ubuntu-gdm-set-background --help
orbash ubuntu-gdm-set-background-transparent --help
There are four options for the plain script which is ubuntu-gdm-set-background
:
- 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 color-hex.com
Example Commands:
sudo bash ubuntu-gdm-set-background --image /home/user/backgrounds/image.jpg
sudo bash ubuntu-gdm-set-background --color \#aAbBcC
sudo bash ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF
sudo bash ubuntu-gdm-set-background --gradient vertical \#aAbBcC \#dDeEfF
sudo bash ubuntu-gdm-set-background --reset
bash ubuntu-gdm-set-background --help
RESCUE_MODE, Example Commands:
sudo bash ubuntu-gdm-set-background --image /home/user/backgrounds/image.jpg rescue
sudo bash ubuntu-gdm-set-background --color \#aAbBcC rescue
sudo bash ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF rescue
sudo bash ubuntu-gdm-set-background --gradient vertical \#aAbBcC \#dDeEfF rescue
Why RESCUE_MODE? When you try to change the background with some other scripts and then interact with this script, there could be some conflicts. In case you ran other scripts to change the background and then tried this script, and found conflicts, then add 'rescue' to the end of the command as mentioned above.
Please note that for RESCUE_MODE
active internet connection is necessary
sudo bash ubuntu-gdm-set-background --color \#456789
sudo bash ubuntu-gdm-set-background --color \#ff00ff
sudo bash ubuntu-gdm-set-background --color \#282828
sudo bash ubuntu-gdm-set-background --gradient vertical \#aAbBcC \#dDeEfF
sudo bash ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF
sudo bash ubuntu-gdm-set-background --color \#8a5f2f
sudo bash ubuntu-gdm-set-background --gradient horizontal \#8ab333 \#2aad9e
sudo bash ubuntu-gdm-set-background --gradient vertical \#3338ab \#00abcd
Has discovered the gradient of the backgrounds thanks to the awesome: https://cssgradient.io/