[FUN STUFF] Lightdm background changer . . . πŸ’«

How to randomly change lightdm background.

The next thing I came up with for myself was to random change the lightdm background every hour in addition to dynamic wallpaper and random pic for betterlockscreen.

So I was prepared to search the internet for single fragments and then make a script from them, etc …

Though … The first search action showed me the following website.
A blog by someone who very finely, in detail, explains how to change the background easily.

For my purpose, I choose scenario 3.


Scenario 3 : random LightDM background.

Read blog first…

Below are the steps without further explanation.

- FIRST STEP. Copy one picture into pixmap folder. [background.XXX]

XXX stands for jpg or png.

$ sudo cp ~/.backgrounds/background.XXX  /usr/share/pixmaps/
$ sudo chown -R <USERNAME>:users /usr/share/pixmaps/background.XXX

- SECOND STEP. Edit lightdm config. Set background.XXX

$ sudo nano /etc/lightdm/lightdm-gtk-greeter.conf
theme-name = Adwaita-dark
icon-theme-name = HighContrast
position = 16%,center 40%,center
screensaver-timeout = 50
background = /usr/share/pixmaps/background.XXX
default-user-image = /usr/share/pixmaps/xterm-color_48x48.xpm
user-background = true
Lines of interest.

background = /usr/share/pixmaps/background.XXX
user-background = true

- THIRD STEP. Create random pix script.


cd /usr/share/pixmaps

# backgrounds path

# Shuffle backgrounds and pick one
background=$(ls $background_home | shuf -n 1)

# Replace current LightDM greeter background
cp $background_home/$background background.XXX

  • I removed the SLEEP part from the script.
  • I decided to use CRONTAB for this purpose. A random picture every hour.
$ chmod +x script.random.pix.sh
$ cp script.random.pix.sh ~/bin
$ crontab -e

# ~~~~
0 * * * * DISPLAY=:0  /home/<USER>/bin/script.random.pix.sh
# ~~~~

$ crontab -l

From now on background of LightDM background changes every hour.


Credits to Edwin Wenink

Have :dizzy: fFUnNn …