How to Setup a Slide Show to Rotate Backgrounds

By: simoncrute

August 30, 2006 12:00 am






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.

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Categories: Uncategorized

Disclaimer: As with everything else in the SUSE Blog, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.