Home page of this blog

Sunday, July 18, 2010

Setting changing wallpapers as background in Ubuntu Lucid

I have often wondered how easy it is to set a group of wallpapers in Windows 7 with a time duration. It is time I did the same in Ubuntu and know it is already there.

I know there are two software which do the task of rotating wallpapers available from synaptic. They are drapes and wally

drapes has dependency on mono (which some will not want to)
wally pulls the entire kdebase-runtime as its dependency  (which I obviously does not want)

The following method uses gnome feature to accept xml file to change/rotate images without installing any of the above packages.

Here is a small howto of what I did to change the backgrounds based on interval step by step

Step 1: Create a directory and copy your images

Step 2: Goto terminal

Step 3: Change to the directory which contains your group of images which needs to be rotated based on interval. Change following script line INTERVAL=20 to desired interval (interval value in seconds) and paste it. If you just paste it, it will create a xml file called bg.xml with 20 seconds as interval between switching to next image

INTERVAL=20; echo "<background>" > bg.xml; for i in *.jpg; do echo "<static><duration>$INTERVAL</duration><file>`pwd`/$i</file></static>" >> bg.xml; done; echo "</background>" >> bg.xml

Step 4: Goto desktop. Right click desktop and invoke Change Desktop Background
(or System --> Preferences --> Appearance --> Background)

press Add... button and change Images to All files from the combo box, then choose bg.xml which we created now

This  will rotate images in Ubuntu Lucid or any gnome environment. The below video shows a background rotation on my desktop with 4 seconds interval.


  1. Thanks for your compliments and blog link :)

    I will look at your blog, though I am not good in photoshop/gimp

  2. Shell script to rotate along with transition

    echo "<background>" > bg.xml
    for cfile in *.jpg
    if [ "$oldfile" != "" ]
    echo "<static><duration>$INTERVAL</duration><file>`pwd`/$oldfile</file></static>" >> bg.xml
    echo "<transition><duration>5.0</duration><from>`pwd`/$oldfile</from><to>`pwd`/$cfile</to></transition>" >> bg.xml
    echo "</background>" >> bg.xml