Saturday, July 14, 2012

Ubuntu 12.04 Unity Background Slideshow

This is how I created my own desktop background slideshow for Unity in Ubuntu 12.04, without overwriting or modifying the system defaults.

First, you'll need to generate a slideshow file.  An example can be found at /usr/share/backgrounds/contest/precise.xml .  I created ~/desktopbackgrounds/ and copied the example file there:

> mkdir ~/desktopbackgrounds/
> cp /usr/share/backgrounds/contest/precise.xml \
~/desktopbackgrounds/slideshow.xml

I then modified it to suit my needs. Alternatively, you can use the script from http://nmlaxaman.blogspot.com/2012/07/generate-wallpaper-slideshow-xml-for.html . You may want to change the duration first. You'll also need to save the images you want in the slideshow to ~/desktopbackgrounds/

> cd ~/desktopbackgrounds/
> ./makebackgroundfile.sh > slideshow.xml

Finally, we need to provide a user-specific version of /usr/share/gnome-background-properties/precise-wallpapers.xml by creating ~/.local/share/gnome-background-properties/ and copying precise-wallpapers.xml there:

> mkdir -p ~/.local/share/gnome-background-properties/
> cp /usr/share/gnome-background-properties/precise-wallpapers.xml \
~/.local/share/gnome-background-properties/

Finally, we need to modify that file to point to our new slideshow. Add or modify an entry as follows:

<wallpaper>
  <name>Custom Slideshow</name>
  <filename>/home/<username>/desktopbackgrounds/slideshow.xml</filename> 
  <options>zoom</options>
</wallpaper>

N.B. that you need to change <username> to your username.

Then, you should be able to edit the background and select your new slideshow!