Solução
- Coloque o script abaixo no diretório
/usr/share/backgrounds
. - Execute uma vez como root.
- Sempre que você adicionar imagens a esse diretório, execute novamente o script.
#!/bin/bash # -------- # Filename fix.sh, by Dean Smith # Run this script once. Thereafter save your best backgrounds in the /usr/share/backgrounds directory. # Each time just run this script to let Ubuntu know you have the new pictures... # AND you can have them auto-rotate if you select the second picture with the clock on it !! # -------- NewXML=/usr/share/gnome-background-properties/ubuntu-wallpapers.xml NewCnt=/usr/share/backgrounds/contest/background-1.xml BGFileDir=/usr/share/backgrounds # -------- if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 exit 1 fi echo Running as root # -------- cd $BGFileDir cd .. chmod -R 777 backgrounds chown -R root backgrounds echo 'directories set so you can add your backgrounds to '$BGFileDir' as jpg' # -------- cd $BGFileDir rename "s/ *//g" *.jpg echo 'Stripped any spaces in the file name' # -------- myn=1 for FILE in $BGFileDir/*.jpg do fname=$(basename $FILE) fbname=${fname%.*} ftwo=${fbname:0:2} if [ $ftwo != "OK" ] then NEWNAME="OK$myn.jpg" while [ -f $NEWNAME ] do #echo $NEWNAME exists, trying a number up let myn=myn+1 NEWNAME="OK$myn.jpg" done #echo $FILE will become $NEWNAME mv $FILE $NEWNAME let myn=myn+1 fi done let myn=myn-1 echo 'Added '$myn' new files to list' # ----------------------------------------------------------------- echo '' > $NewXML echo '' >> $NewXML echo '' >> $NewXML # ----- myn=1 for FILE in $BGFileDir/*.jpg do if [ $myn = 2 ] then echo '' >> $NewXML echo ' Contest' >> $NewXML echo ' '$FILE'' >> $NewXML echo ' zoom' >> $NewXML echo '' >> $NewXML else echo '' >> $NewXML echo ' '$myn'' >> $NewXML echo ' '$FILE'' >> $NewXML echo ' zoom' >> $NewXML echo ' #2c001e' >> $NewXML echo ' #2c001e' >> $NewXML echo ' solid' >> $NewXML echo '' >> $NewXML fi let myn=myn+1 done echo '' >> $NewXML echo 'Wallpaper list for Ubuntu reset and updated' # ----------------------------------------------------------------- echo '' > $NewCnt echo ' ' >> $NewCnt echo ' 2009' >> $NewCnt echo ' 08' >> $NewCnt echo ' 04' >> $NewCnt echo ' 00' >> $NewCnt echo ' 00' >> $NewCnt echo ' 00' >> $NewCnt echo ' ' >> $NewCnt # ----- myn=1 for FILE in $BGFileDir/*.jpg do if [ $myn = 1 ] then LoopBackFile=$FILE else echo ' '$FILE'' >> $NewCnt echo '' >> $NewCnt fi echo '' >> $NewCnt echo ' 600' >> $NewCnt echo ' '$FILE'' >> $NewCnt echo '' >> $NewCnt echo '' >> $NewCnt echo ' 5.0' >> $NewCnt echo ' '$FILE'' >> $NewCnt let myn=myn+1 done echo ' '$LoopBackFile'' >> $NewCnt echo ' ' >> $NewCnt echo '' >> $NewCnt echo 'Timed Wallpaper list for Ubuntu reset and updated' # -----