-[ My gdm background hack ]-







I use gdm as my graphical login manager, and using the following two script snippets you can have it start up with a random, dynamic background each time, You'll need to make sure you have the xscreensaver (and xscreensaver-gl if you desire) package installed.
Put this in your /etc/gdm/Init/Default script
Rand=`expr $RANDOM % 10`
case $Rand in
	0) echo "xmatrix" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/xmatrix -root -small -delay 100000 -density 40 &

	1) echo "ripples" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/ripples -root -oily -light 2 &

	2) echo "xflame" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/xflame -root &

	3) echo "cynosure" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/cynosure -root &

	4) echo "coral" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/coral -root -delay 0 &

	5) echo "blaster" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/blaster -root &

	6) echo "starwars" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/starwars -root &
	7) echo "xrayswarm" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/xrayswarm -root &
	8) echo "whirlwindwarp" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/whirlwindwarp -root &
	9) echo "goop" > /var/local/gdm/back.dat
		/usr/lib/xscreensaver/goop -root -maxvelocity 0.6 -elasticity 0.9 &

Obviously you can change which screensavers run as a background, and tweak the arguments passed to each of those, check your xscreensaver documentation for more info.
Put this in your /etc/gdm/PreSession/Default script
# The following line was already in the script
# Don't add it if yours doesn't have this already.
/usr/bin/X11/sessreg -a -w /var/log/wtmp -u /var/run/utmp -l $DISPLAY $USER

# From here on relates to the dynamic background hack
Name=`cat /var/local/gdm/back.dat`
BPID=`pidof $Name`
kill $BPID

This will kill off whichever screensaver background was running, just before it spawns the relevant Xsession. Both these script snippets are fairly basic since it's my first attempt at shell scripting, if you have any comments or additions mail them to capn-k(NOSPAM)@helmsdeep.net, and remove the (NOSPAM) from the address.

Last Modified: August 8, 2002, 3:35 am
Layout Copyright © 2001 Dan Hersam - All Rights Reserved
Remixed by Capn-K