Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Site Navigation
Linux Forums
Linux Articles
Product Showcase
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Free Publications

Configure GDM3 to display random images from directory upon login screen.

A way to random background images in GDM3 - Debian 6. Should be applicable to other distributions, the only difference being configuration file paths.

If you know of a simpler approach please let us know.

PRECAUTION: I'm just a newbie customizing a family laptop, this may not work, or slow down or expose your system in ways i do not understand.
Follow procedure at your own risk.

1- Creating PostLogin bash script. #as root

cp /etc/gdm3/PostLogin/Default.sample /etc/gdm3/PostLogin/Default

2- Editing PostLogin bash script, this will take a random image from directory and make it the background image #as root

Add the following to /etc/gdm3/PostLogin/Default and adjust the path to point your images directory.
#change background image
file=`/bin/ls -1 "$dir" | sort --random-sort | head -1`
path=`readlink -f "$dir/$file"` # Converts to full path
cp $path /wherever/you/want/background.jpg

3- Create the background image and change permissions for all users to change background image when logging out.

touch /wherever/you/want/background.jpg
chmod 777 /wherever/you/want/background.jpg #do not know if this is necessary

4- Editing GDM3 configuration file #as root

edit /etc/gdm3/greeter.gconf-defaults

Uncomment the following line and change background image path

/desktop/gnome/background/picture_filename      /wherever/you/want/background.jpg

Optionally uncomment:
/desktop/gnome/background/picture_options       zoom

And adjust config file to your likings.

I reused the bash code in step 2 from somewhere i cannot remember, if you are the author please let me know and i will 
link to source.

Rate This Article: poor excellent
Comments about this article
One more step
writen by: kuakuaamen on 2011-03-10 01:14:33
5- Restarting GDM3

invoke-rc.d gdm3 reload

/etc/init.d/gdm3 restart
RE: One more step written by kuakuaamen:

Comment title: * please do not put your response text here