1

It seems that LightDM's GTK greeter doesn't support choosing a random image from a folder. Does any one know of a way to achieve this without resorting to the webkit greeter?

Emily L.
  • 534
  • 5
  • 13

1 Answers1

1

I ended up creating an init script that will run before the DM and edit the gtk greeter config with a random image from /usr/share/backgrounds/xdm/.

It's basically a one liner to edit the config which should be easily adaptable to other init systems (this is for OpenRC).

File: /etc/init.d/random-xdg-bg

#!/sbin/openrc-run

depend() {
    before xdm
}

start() {
    ebegin "Setting random background for XDM"
    sed -i -e "s:^background=.*:background=`find "/usr/share/backgrounds/xdm/" -exec file {} \;| grep -o -P '^.+: \w+ image' | sort -R | tail -1 | sed -e 's/:[^:]*image//g'`:g" /etc/lightdm/lightdm-gtk-greeter.conf
    eend $?
}

stop() {
    ebegin "Stopping random background for XDM"
    eend $?
}

Then:

# rc-update add default random-xdg-bg
Emily L.
  • 534
  • 5
  • 13