/ubuntu-gdm-set-background

Set GDM Background for Ubuntu (Versions Starting from 20.04 till 23.10 Only)

Primary LanguageShellGNU General Public License v3.0GPL-3.0

ubuntu-gdm-set-background

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.


Note:

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]

  1. Boot a desktop session
  2. Verify that the greeter shows the default aubergine background.
  3. Login as the administrator of the machine
  4. Install systemd-container
  5. Switch to the GDM user: $ sudo machinectl shell gdm@ /bin/bash
  6. Apply a different background with the command: $ gsettings set com.ubuntu.login-screen background-picture-uri 'file:///usr/share/backgrounds/warty-final-ubuntu.png'
  7. Logout
  8. Verify that the greeter now shows the image warty-final-ubuntu.png.

UPDATES for Ubuntu 23.04+

for Ubuntu 23.10/Gnome 45

This is highly recommonded way: https://github.com/PRATAP-KUMAR/gdm-extension - as it avoids having to recompile gresources.

for Ubuntu 23.04+

  1. ubuntu-gdm-set-background -> has four options just like the previous versions: Image, Color, Gradient Horizontal, Gradient Vertical.
  2. ubuntu-gdm-set-background-transparent -> sets the login-background color transparent so that the background set via gsettings 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

Installation

  1. clone the repo git clone https://github.com/PRATAP-KUMAR/ubuntu-gdm-set-background.git
  2. cd ubuntu-gdm-set-background
  3. bash ubuntu-gdm-set-background --help or bash ubuntu-gdm-set-background-transparent --help

There are four options for the plain script which is ubuntu-gdm-set-background:

  1. background with image
  2. background with color
  3. background with gradient horizontal ( requires two valid hex color inputs)
  4. 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:

  1. sudo bash ubuntu-gdm-set-background --image /home/user/backgrounds/image.jpg
  2. sudo bash ubuntu-gdm-set-background --color \#aAbBcC
  3. sudo bash ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF
  4. sudo bash ubuntu-gdm-set-background --gradient vertical \#aAbBcC \#dDeEfF
  5. sudo bash ubuntu-gdm-set-background --reset
  6. bash ubuntu-gdm-set-background --help

RESCUE_MODE, Example Commands:

  1. sudo bash ubuntu-gdm-set-background --image /home/user/backgrounds/image.jpg rescue
  2. sudo bash ubuntu-gdm-set-background --color \#aAbBcC rescue
  3. sudo bash ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF rescue
  4. 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

Screenshots (some with their respective recipe command below each)

1

2

3

4

sudo bash ubuntu-gdm-set-background --color \#456789

5

sudo bash ubuntu-gdm-set-background --color \#ff00ff

6

sudo bash ubuntu-gdm-set-background --color \#282828

7

sudo bash ubuntu-gdm-set-background --gradient vertical \#aAbBcC \#dDeEfF

8

sudo bash ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF

9

sudo bash ubuntu-gdm-set-background --color \#8a5f2f

10

sudo bash ubuntu-gdm-set-background --gradient horizontal \#8ab333 \#2aad9e

11

sudo bash ubuntu-gdm-set-background --gradient vertical \#3338ab \#00abcd

Has discovered the gradient of the backgrounds thanks to the awesome: https://cssgradient.io/