Say you want a random Gnome wallpaper from google each 60 seconds, but if your machine is not connected, just take
the backdrop from a local directory ~/Desktop/backdrops. you can put up a couple of scripts to do this, the main one
would be /scripts/changewall.ksh
#!/bin/bash
mkdir -p /tmp/wallpapers
E=`ps -ef | grep -i changewall | grep -i $USER | grep -iv grep | wc -l`
if [ $E -gt 2 ];then
echo “wallpaper changer already running for $USER”
exit 1
fi
i=120
while true;do
i=`cat /scripts/time.txt`
rm -fR /tmp/wallpapers/*
RANGE=10
number=$RANDOM
let “number %= $RANGE”
number=$(($number))
ping -w 10 -c 2 www.google.com > /dev/null 2>&1
R=$?
if [ $R -eq 0 ] && [ $number -lt 9 ];then
/scripts/wallpaper.ksh > /dev/null 2>&1
F=`ls /tmp/wallpapers`
N=`echo $F | wc -c`
if [ $N -gt 1 ];then
gconftool-2 -t string -s /desktop/gnome/background/picture_filename “/tmp/wallpapers/$F”
# cp “/tmp/wallpapers/$F” $HOME/Desktop/backdrops/
else
cd $HOME/Desktop/backdrops
ls -1 *.jpg | head -n`expr $RANDOM % `ls -1 *.jpg | wc -l“ | tail -n1 | echo `pwd`/`xargs` | gconftool-2 -t string -s /desktop/gnome/background/picture_filename “`xargs`”
fi
else
cd $HOME/Desktop/backdrops
ls -1 *.jpg | head -n`expr $RANDOM % `ls -1 *.jpg | wc -l“ | tail -n1 | echo `pwd`/`xargs` | gconftool-2 -t string -s /desktop/gnome/background/picture_filename “`xargs`”
fi
sleep $i
done
Then you would need the support script, to get images from google according to a random word that comes
from /scripts/wallpaper-subjects.txt program: /scripts/wallpaper.ksh
#!/bin/ksh
cat /scripts/wallpaper-subjects.txt | head -n`expr $RANDOM % `cat /scripts/wallpaper-subjects.txt | wc -l“ | tail -n1 > /tmp/subject
QUERY=`cat /tmp/subject | sed ‘s/ /%20/g’`
RANGE=10
number=$RANDOM
let “number %= $RANGE”
number=$(($number + 1))
IMG=`curl -m 10 -A “Mozilla/3.0 (compatible; AvantGo 3.2)” “http://images.google.com/images?as_q=${QUERY}&as_filetype=jpg&biw=1680&bih=1024&safe=active&as_st=y&tbs=isch:1,itp:photo,islt:2mp,isz:l,ift:jpg” 2>/dev/null |sed -e ‘s/>/>n/g’ | awk ‘{s=substr($0,index($0,”http”),index($0,”jpg”));print substr(s,1,index(s,”.jpg”)+3)}’ | grep jpg |egrep -v ‘starkeith|gstatic|scaredmonkeys|tripod|flickr’|sed ‘s/2520/20/g’ | head -$number | tail -1`
mkdir -p /tmp/wallpapers
cd /tmp/wallpapers
wget –timeout=10 $IMG
you can add /scripts/changewall.ksh to your autostart stuff in gnome, going to system –> preferences –>
startup applications
ENJOY!