# \[FUN STUFF\] Lightdm background changer . . . 💫

**URL:** <https://forum.maboxlinux.org/t/fun-stuff-lightdm-background-changer/1399>\
**Category:** Openbox and friends\
**Created:** [June 17, 2023, 9:16am UTC](https://forum.maboxlinux.org/t/fun-stuff-lightdm-background-changer/1399 "2023-06-17T09:16:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![muzqs](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/muzqs/32/3702_2.png) [@muzqs](https://forum.maboxlinux.org/u/muzqs)\
**Post date:** [June 17, 2023, 9:16am UTC](https://forum.maboxlinux.org/t/fun-stuff-lightdm-background-changer/1399/1 "2023-06-17T09:16:01Z")

</div>

# 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.`

> **[Pick a random background on each boot (Linux)](https://www.edwinwenink.xyz/posts/40-arch_background/)**

# 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._

```auto
$ 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

```auto
$ sudo nano /etc/lightdm/lightdm-gtk-greeter.conf

```

```auto
[greeter]
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.

```auto
#!/bin/bash

cd /usr/share/pixmaps

# backgrounds path
background_home=${HOME}/.backgrounds

# 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.

```auto
$ chmod +x script.random.pix.sh

```

```auto
$ cp script.random.pix.sh ~/bin

```

```auto
$ crontab -e

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

```

```auto
$ crontab -l

```

### From now on background of LightDM background changes every hour.

🐦

_Credits to Edwin Wenink_

Have 💫 fFUnNn …
