I have it start every time i log in by going to System -> Preferences -> Personal -> Sessions (Add):
#! /bin/bash
# System -> Preferences -> Personal -> Sessions
function dohelp() {
echo "$0 has three optional arguments."
echo "'-d dirname' to specify the directory to examine (~/Backgrounds"
echo " by default)."
echo "'-s sleep' to specify the number of seconds to sleep between"
echo " changing backgrounds (1800 (half an hour) by default)."
echo "'-m method' to specify the method of displaying the images."
echo " Values are:"
echo " 'zoom' to fill the screen and chop off any extra from the two"
echo " edges that overflow. Aspect ratio is maintained. This is"
echo " the default."
echo " 'scaled' to fit the image to two edges and fill with the"
echo " background color on the two edges that don't reach."
echo " Aspect ratio is maintained."
echo " 'streched' to fit the image to all four edges while not"
echo " maintaining the aspect ratio."
echo " 'centered' to place on the screen with no scaling at all"
echo " 'wallpaper' to repeat the image as many times as it will fit"
echo " with no scaling."
echo " One can also have picture-specific methods by creating a file"
echo " prefixed by a dot ".DSC0001.jpg for example" that has one word"
echo " in it, either zoom, scaled, streched, centered, or wallpaper."
echo " If none is specified, the default is used."
exit
}
DIRNAME=~/Backgrounds
SLEEP=1800
METHOD=zoom
while getopts 'd:s:m:h' OPTION
do
case $OPTION in
d) DIRNAME="$OPTARG" ;;
s) SLEEP="$OPTARG" ;;
s) METHOD="$OPTARG" ;;
h) dohelp ;;
?) echo "Usage: [-d directory] [-s sleep] [-m method]" >&2
exit 2
;;
esac
done
FILENAME=/desktop/gnome/background/picture_filename
OPTIONS=/desktop/gnome/background/picture_options
method=$METHOD
gconftool-2 --type string --set $OPTIONS $method
while true
do
# (re)read directory to pick up any new files
for i in $DIRNAME/*
do
filename=${i#$DIRNAME/}
# echo $filename
methodfile=$DIRNAME/.$filename
if [[ -e $methodfile ]]
then
# echo $methodfile exists
newmethod=`cat $methodfile`
else
newmethod=$METHOD
fi
if [[ $newmethod != $method ]]
then
gconftool-2 --type string --set $OPTIONS $newmethod
method=$newmethod
fi
gconftool-2 --type string --set $FILENAME $i
sleep $SLEEP
done
done