Novell is now a part of Micro Focus

How to Setup a Slide Show to Rotate Backgrounds

Novell Cool Solutions: Tip
By Simon Crute

Digg This - Slashdot This

Posted: 30 Aug 2006


In GNOME, there is not a way to setup a slide show to rotate backgrounds. But, this is easy to solve.


Using some shell programming, the gconf tool, and cron you can easily create this.

Alot of the variables could be got rid of, but using them helps make the script clearer.

$RANDOM produces a random number between 1 and 32767. We have to multiply it by the number of files first, because if we divide it by 32767 BASH will round the number to 0...


Create the following script as /usr/local/bin/change_background

#bash script to change background

#directory to read (change this for your machine. 
#extention to read

FILES=( $(find $DIR -iname "*$FILE_EXT" ) )


#this is all on one  line
/opt/gnome/bin/gconftool-2 -s /desktop/gnome/background/picture_filename -t 
string "${FILES[$FILE_INDEX]}"

Make the file executable

chmod +x /usr/local/bin/change_background

Now, run this a couple of times and check it all works. If it does, add it to *your* crontab.

To edit your crontab, run

crontab -e 

Add the following line

0-59/10 * * * * /usr/local/bin/change-background

which can be described as "when the minutes fall between 0 and 59 devisable by 10, and hours, days, month and day of the week are anything, run /usr/local/bin/change_background".


Assume all your pictures are in the your show directory, and you want to change pictures every 10 minutes.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates