Create a Wallpaper Slideshow on Ubuntu (Updated)
Posted on March 29, 2010 by robbychen
Update (12/08/2010): For some of you having trouble to run the PHP script, I posted a tutorial on how to install web server with PHP to help you who are non web developers to run the PHP scripts I wrote. Take a look here and leave a comment if you have any questions.
UPDATE (09/01/2010): I wrote a PHP script that will help you generate background.xml file easier. I also made a video tutorial on how to use the script. You can find it along with the video in this post.
I also experimented with duration time when testing the script and found out that all of the durati0n time stated in the file are actually in seconds. For this reason, I changed all the milliseconds in this post to seconds.
UPDATE (08/24/2010): I added one more step in the last part of this post. Please see the detailed step below.
I have many collections of wallpapers that I downloaded from DeviantArt.com, art.gnome.org, and other sites, but I never used them as my desktop wallpapers, mainly because I didn’t want to manually switch wallpaper from time to time. Recently I have had an idea to make a slideshow from these wallpapers thanks to the cosmos wallpaper collection in the background section in the Appearance Preferences on Ubuntu. After I took a look in the cosmos directory in /usr/share/backgrounds/, I discovered that the slideshow is controlled by a xml file. The content of the xml file is very straightforward:
<background>
<starttime>
<year>2009</year>
<month>08</month>
<day>04</day>
<hour>00</hour>
<minute>00</minute>
<second>00</second>
</starttime>
<!– This animation will start at midnight. –>
<static>
<duration>1795.0</duration>
<file>/usr/share/backgrounds/cosmos/cloud.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/cloud.jpg</from>
<to>/usr/share/backgrounds/cosmos/comet.jpg</to>
</transition>
…
</background>
You should understand the format of the above xml content very easily. If not, here are my basic explanation for each syntax:
- <background> needs to be wrapped outside the whole document, it gives Ubuntu the ability to open this file as background/wallpaper.
- You can set the values inside <starttime> to whenever you want to start the slideshow. The syntax inside <starttime> is self-explanatory. If you set the start time before the time right now, the slideshow will start automatically after you open this xml file as wallpaper in the Appearance Preferences window.
- <static> contains two properties, <duration> and <file>.
- <duration> is the time to display the wallpaper before change to the next wallpaper in seconds.
- <file> is the absolute location that the wallpaper is located.
(You can place each wallpaper and this xml file in different location if you want, but I prefer to place these files in one folder)
- <transition> contains three properties that controls the time and direction that slideshow is transit to.
- <duration> is the time that the transition will take in seconds.
- <from> is the location of the current wallpaper.
- <to> is the location of the next wallpaper.
- Repeat the <static> and <transition> process as you want as long as you have different wallpapers.
- In the last <transition>, you must place the first wallpaper in this list into the <to> property in order to loop your wallpapers continuously.
Here is the backgrounds.xml file that I created:
<background> <starttime> <year>2010</year> <month>03</month> <day>29</day> <hour>05</hour> <minute>38</minute> <second>00</second> </starttime> <static> <duration>50.0</duration> <file>/home/robbychen/Downloads/Wallpapers/dreamyblue.png</file> </static> <transition> <duration>5.0</duration> <from>/home/robbychen/Downloads/Wallpapers/dreamyblue.png</from> <to>/home/robbychen/Downloads/Wallpapers/dreamybrown.png</to> </transition> <static> <duration>50.0</duration> <file>/home/robbychen/Downloads/Wallpapers/dreamybrown.png</file> </static> <transition> <duration>5.0</duration> <from>/home/robbychen/Downloads/Wallpapers/dreamybrown.png</from> <to>/home/robbychen/Downloads/Wallpapers/dreamycrimson.png</to> </transition> <static> <duration>50.0</duration> <file>/home/robbychen/Downloads/Wallpapers/dreamycrimson.png</file> </static> <transition> <duration>5.0</duration> <from>/home/robbychen/Downloads/Wallpapers/dreamycrimson.png</from> <to>/home/robbychen/Downloads/Wallpapers/dreamyinverted.png</to> </transition> <static> <duration>50.0</duration> <file>/home/robbychen/Downloads/Wallpapers/dreamyinverted.png</file> </static> <transition> <duration>5.0</duration> <from>/home/robbychen/Downloads/Wallpapers/dreamyinverted.png</from> <to>/home/robbychen/Downloads/Wallpapers/Linux_wallpaper_by_varian.jpg</to> </transition> <static> <duration>50.0</duration> <file>/home/robbychen/Downloads/Wallpapers/Linux_wallpaper_by_varian.jpg</file> </static> <transition> <duration>5.0</duration> <from>/home/robbychen/Downloads/Wallpapers/Linux_wallpaper_by_varian.jpg</from> <to>/home/robbychen/Downloads/Wallpapers/Ubuntu-Sun.png</to> </transition> <static> <duration>50.0</duration> <file>/home/robbychen/Downloads/Wallpapers/Ubuntu-Sun.png</file> </static> <transition> <duration>5.0</duration> <from>/home/robbychen/Downloads/Wallpapers/Ubuntu-Sun.png</from> <to>/home/robbychen/Downloads/Wallpapers/dreamyblue.png</to> </transition> </background>
After you created this file, open the Appearance Preferences and go to Background section. Click Add button and select the xml file that you created.
Update (08/24/2010): As I described in the comment below, you need to select All files on top of the Open button in the Add Wallpaper dialog box (default is Images) in order to see the xml file.
Click open and you should see a stack of images that is similar to the cosmos background:
Visit here to learn more about XML, and please leave a comment if you have any problem creating your own slideshow. I will glad to help you.
There are no posts related to Create a Wallpaper Slideshow on Ubuntu (Updated).
- Share this:
Site Design by: Press75.com | Powered by: WordPress

Thanks a lot you helped me a lot!
You are welcome.
have you notice the changing between pictures isn’t very smooth? what programme should i be looking at?
Hi O15977,
I don’t know what do you mean by which program? I just used gedit to create the xml file. The transition between pictures isn’t very smooth is probably because the transition duration time that you set is too short.
really good post.Thanks
Wow! Really amazing.Thanks.
I did this and when I add it into appearance preferences and select it it says image not found. Any idea what i might have done wrong?
Hi, Max. One possible reason I can think of is that your xml file maybe include relative path of your images. GNOME appearance only accepts absolute path. For example, your images are in the /home/usr/wallpapers directory together with the xml file, you must set path of the images in your xml file to /home/usr/wallpapers/image1.jpg, /home/usr/wallpapers/image2.jpg, and so on, instead of just image1.jpg, image2.jpg …
Hope this helps. Please post the content of your xml file if it doesn’t solve your problem. Thanks.
[...] to make a video version of the post along with each post. Here is my first video showing how to create a wallpaper slideshow in Ubuntu, one of the popular posts I wrote back to March of this [...]
I’m not seeing the .xml file when I navigate there through pref/appearances/backgrounds/add
All I see are my images?
Hi, skeeterflea. As I stated in the beginning of this post, you need to navigate to the background source directory which is /usr/share/backgrounds/ in Ubuntu. Then go to the “cosmos” directory. Copy the file “background-1.xml” to the directory that you want to setup the desktop slideshow and customize it to your preference.
Please feel free to write a reply comment if you have any problem.
Hi, skeeterflea, sorry about my last comment. I know what you mean now. You need to choose to show All files at the top of the Open button in the Add Wallpaper dialog box, then choose your .xml file. Hope this helps.
[...] This post was mentioned on Twitter by Didier Misson, Robby Chen. Robby Chen said: 5 Flower wallpapers for #Ubuntu http://bit.ly/ae45PO if you want to make a slideshow from multiple wallpapers, checkout http://bit.ly/brrEDm [...]