Advanced Background Slideshows in Ubuntu

I have been enjoying the background images in the more recent versions of Ubuntu, especially in conjunction with the included slideshow which automatically moves through the images included with each particular version.  I have one machine where I have upgraded it from 13.04 to 13.10 and finally to 14.04.  The trouble is that each version has its own images and slideshow, and I wanted a way to combine them all into a single slideshow.

I figured these were being stored somewhere as a list and I just needed to find and modify that list.  What I have found will be useful if you would like to either do what I have done, add some of your own images to the built-in slideshows, or even create your own slideshows in the list.

After a little digging I found two files which will assist in this endeavor.

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

/usr/share/backgrounds/contest/trusty.xml

So take note of these files and the folders which contain them.  First, in each of the containing folders (in bold) there will be entries for each version your machine has upgraded through.  If you have simply done a fresh install of 14.04 (for example) you will only have an entry for Trusty, but if (like me) you have upgraded starting with 13.04 you will see entries for Raring, Saucy, and Trusty.  All machines should have the ubuntu-wallpapers.xml entry.

The XML files located in gnome-background-properties contain information System Settings —> Appearance —> Backgrounds uses to populate its roster.  If your image or slideshow file doesn’t have an entry here, it will not appear there.

The XML files located in backgrounds/contest are the slideshow files.  Manipulating them or creating a new one (which I did) will alter (or create) your existing slideshows.

To create a slideshow of all the images from each of the three versions on my system, I first created a file called all.xml inside the backgrounds/contest folder.  I then populated that file with information culled from all three of the other slideshow XML files also in backgrounds/contest.

Let’s go over that briefly.

First, to create the file you can simply use touch as the super-user (the folders in which we are working at root-level access only; normally users should stay out).  Just enter this command in your terminal:

sudo touch /usr/share/backgrounds/contest/all.xml

Name it whatever you’d like.  I chose all because I’m making a slideshow from all of the existing (on that system) stock images.

Now you can modify that file again using elevated privledges:

gksudo gedit /usr/share/backgrounds/contest/all.xml

Note that you should be very careful using your text editor while elevated as you can break your system by opening, changing, and saving the wrong file.

I just opened the other XML slideshow files and copied out the relevant sections to create my super slideshow file.  Here are the basics.


<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. -->

<!-- Raring -->

...

  <static>
    <duration>595.0</duration>
    <file>/usr/share/backgrounds/Leftover_by_Sagar_Jain.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Leftover_by_Sagar_Jain.jpg</from>
    <to>/usr/share/backgrounds/Stop_the_light_by_Mato_Rachela.jpg</to>
  </transition>

...

</background>

The background tag surrounds the entire document.  Each slideshow entry is supported by static and transition tags.  You will need that bit at the top in your slideshow (I guess; I included it), and you will need an entry (static and transition) for each image file you want included.

Note, the default transition time was set to 1795 seconds and I reduced mine to 595 seconds (just under 30 minutes and just under ten minutes respectively).  You should be able to set the duration time for each file the same or different as you see fit.

Also, the transitions in each of the existing files includes one which transitions from the last image to the first image.  You will want to adjust any transitions so ensure that each file transitions to the next in line and then the final transition should point back to the first image.

If all you have done is modify the existing slideshow file(s) you are done (unless you want to include those new images files in the System Settings dialog as individual options).  If you have created a new file, you will now want to add a reference to that file in the ubuntu-wallpapers.xml file.

Mine now looks like this:


...

<wallpapers>

...

  <wallpaper deleted="false">
    <name>All 13.04 - 14.04 Community Wallpapers</name>
    <filename>/usr/share/backgrounds/contest/all.xml</filename>
    <options>zoom</options>
  </wallpaper>

...

</wallpapers>

That’s pretty much it.  You can see how this works. The whole of your wallpaper options are wrapped in the wallpapers tag and each individual entry is wrapped in its own wallpaper tag. (I have not explored any options except the default zoom.)

There is one last item to note (though I did not have need of this myself).  If you want to see an image you have added appear in the roster, it will need to appear in one of the XML files in the /usr/share/gnome-background-properties/ folder.  The slideshow won’t appear in Systems Settings until you include its entry (as we have done above) and neither will any file you would like to select individually.  You may be able to create your own XML files in this folder as well (as we did similarly in creating the all.xml file) but I have not tested this.

Have fun with that.

Share

One thought on “Advanced Background Slideshows in Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *