[ubuntu-uk] gnome desktop background changer

Steve Fisher xirconuk at gmail.com
Sat Oct 16 13:52:22 BST 2010


God, this was hard work!  But I think it runs, needs testing and all the
paths are hardcoded and need changing.

So I am assembling a directory of jpegs and will report back, but going out
(again) for a while.

#!/bin/bash
rm background-1.xml
echo "<background>" >> background-1.xml
echo "  <starttime>" >> background-1.xml
echo "    <year>2009</year>" >> background-1.xml
echo "    <month>08</month>" >> background-1.xml
echo "    <day>04</day>" >> background-1.xml
echo "    <hour>00</hour>" >> background-1.xml
echo "    <minute>00</minute>" >> background-1.xml
echo "    <second>00</second>" >> background-1.xml
echo "  </starttime>" >> background-1.xml
echo "<!-- This animation will start at midnight. -->" >> background-1.xml

#counter variable
x=1

for file in *

do
#echo $x
 if [ $x -eq 1 ]
then
FE='<to>/usr/share/backgrounds/cosmos/'
FE="${FE}$file"
FE="${FE}</to>"
fi
 if [ $x -gt 1 ]
then
FT='<to>/usr/share/backgrounds/cosmos/'
FT="${FT}$file"
FT="${FT}</to>"
echo $FT >> background-1.xml
fi
 echo "  <static>" >> background-1.xml
echo "    <duration>1795.0</duration>" >> background-1.xml
 FS="   <file>/usr/share/backgrounds/cosmos/"
FS="${FS}$file"
FS="${FS}</file>"
 FR="   <from>/usr/share/backgrounds/cosmos/"
FR="${FR}$file"
FR="${FR}</from>"
 FT="   <to>/usr/share/backgrounds/cosmos/"
FT="${FT}$file"
FT="${FT}</to>"
 echo $FS >> background-1.xml
echo "  <static>" >> background-1.xml
echo "    <duration>5.0</duration>" >> background-1.xml
echo $FR >> background-1.xml
echo "</transition>" >> background-1.xml
     #ls "$file"  # Lists all files in $PWD (current directory).

    x=$(( $x + 1 ))

    #echo $x

done

echo $FE >> background-1.xml
echo "</transition>" >> background-1.xml
echo "</background>" >> background-1.xml

exit 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-uk/attachments/20101016/47d88ad0/attachment.htm 


More information about the ubuntu-uk mailing list