[ubuntu-uk] gnome desktop background changer
Steve Fisher
xirconuk at gmail.com
Sat Oct 16 16:40:39 BST 2010
OK script finished tested and working:
#!/bin/bash
rm background-2.xml
echo "<background>" >> background-2.xml
echo " <starttime>" >> background-2.xml
echo " <year>2009</year>" >> background-2.xml
echo " <month>08</month>" >> background-2.xml
echo " <day>04</day>" >> background-2.xml
echo " <hour>00</hour>" >> background-2.xml
echo " <minute>00</minute>" >> background-2.xml
echo " <second>00</second>" >> background-2.xml
echo " </starttime>" >> background-2.xml
echo "<!-- This animation will start at midnight. -->" >> background-2.xml
#counter variable
x=1
for file in *.jpg
do
if [ $x -eq 1 ]
then
FE='<to>/usr/share/backgrounds/testdir/'
FE="${FE}$file"
FE="${FE}</to>"
fi
if [ $x -gt 1 ]
then
FT='<to>/usr/share/backgrounds/testdir/'
FT="${FT}$file"
FT="${FT}</to>"
echo $FT >> background-2.xml
echo "</transition>" >> background-2.xml
fi
echo " <static>" >> background-2.xml
echo " <duration>1795.0</duration>" >> background-2.xml
FS=" <file>/usr/share/backgrounds/testdir/"
FS="${FS}$file"
FS="${FS}</file>"
FR=" <from>/usr/share/backgrounds/testdir/"
FR="${FR}$file"
FR="${FR}</from>"
FT=" <to>/usr/share/backgrounds/testdir/"
FT="${FT}$file"
FT="${FT}</to>"
echo $FS >> background-2.xml
echo " </static>" >> background-2.xml
echo " <transition>" >> background-2.xml
echo " <duration>5.0</duration>" >> background-2.xml
echo $FR >> background-2.xml
#ls "$file" # Lists all files in $PWD (current directory).
x=$(( $x + 1 ))
#echo $x
done
echo $FE >> background-2.xml
echo "</transition>" >> background-2.xml
echo "</background>" >> background-2.xml
exit 0
Change "/usr/share/backgrounds/testdir/" to match your directory with search
& replace.
Will tart it up with zenity later.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-uk/attachments/20101016/a91cea06/attachment-0001.htm
More information about the ubuntu-uk
mailing list