Home > Computers, Howto, Linux > Desktop wallpaper slideshow in Ubuntu 11.10

Desktop wallpaper slideshow in Ubuntu 11.10

February 16th, 2012

For no other reason than “it looks nice” (and showing snooty Windows users that we can do anything they can do – and in hundreds of different ways :) ), I decided to set up my desktop wallpaper to change at different times throughout the day.

There are programs in the repositories which will do this (notably CREBS and wallch), but I like to keep things reasonably light by not having too many other processes running in the background.

The standard desktop background applet comes with this functionality built in, and creating your own slideshow from scratch is a fun and geeky project.

To do this, you need to create a folder in /usr/share/backgrounds to hold your pictures. I created one called mattpix:

sudo mkdir /usr/share/backgrounds/mattpix

I then copied my pictures in there, and added an xml file called background-1.xml. The settings in the file are fairly self-explanatory, and here’s the format:

<background>
 <starttime>
 <year>2010</year>
 <month>05</month>
 <day>06</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/mattpix/emirates.jpg</file>
 </static>
 <transition>
 <duration>5.0</duration>
 <from>/usr/share/backgrounds/mattpix/emirates.jpg</from>
 <to>/usr/share/backgrounds/mattpix/MistyMorning.jpg</to>
 </transition>
 ...
</background>

You can pretty much ignore the first few lines under “background”, the interesting bit starts from the <static> tag under the comment.

<duration> is the time in seconds that the picture will stay as the background.

<file> is the path to the background image.

The <transition> section determines how long the cross-fade will last (5 seconds in my case), and what picture we’re transitioning to.

Then there will be another <static> tag for the new image (…/mattpix/MistyMorning.jpg in this case), and another <transition> and so on and so forth. Eventually the whole file is closed with a </background> tag.

When the file is created, I did the following to make the background appear in the Desktop Background applet.

 gksudo gedit /usr/share/gnome-background-properties/ubuntu-wallpapers.xml

and added the following section between the tags:

Matt's Pix
 /usr/share/backgrounds/mattpix/background-1.xml
 zoom

When you go back to change your screensavers, you’ll notice your new one has appeared. If you’ve left the duration the same, then your background will change every 1795 seconds with a 5 second transition, which is 30 minutes.

  1. Ken
    April 17th, 2012 at 05:56 | #1

    hey, I’m not much of a computer expert, but I’ve been trying to create a desktop slideshow on Ubuntu, and so I decided to go with your method.

    I tried following your instructions to the letter, but when I got to the last step (adding the new info into the ubuntu-wallpaper.xml file) I got stuck – I wasn’t sure which tags to put the new section in, so I tried adding it beneath this section:

    contest
    /usr/share/backgrounds/contest/background-1.xml
    zoom

    I closed the document and the terminal, then went to the desktop background applet and nothing had changed. So I went back into the xml document, deleted the section I had added, and this time edited the above-quoted section to say:

    Classics
    /usr/share/backgrounds/Classics/background-1.xml
    zoom

    This time when I went back to the desktop background applet, the old desktop slideshow had been replaced by another one. I clicked on it, the desktop background went totally black and unity shut down. I was able to fix the problem by rebooting and changing the xml file back to what it originally was, but that still leaves me without the custom desktop slideshow I was trying to create.

    I realize this isn’t your job, but do you think you could advise me on where I went wrong, and where in the xml file I’m supposed to add the section?

  2. April 23rd, 2012 at 11:33 | #2

    Hi – sorry for the delayed response, we were on holiday for a week. If you want to paste your xml file here, I’ll debug it for you :)

Comments are closed.