Blog

Warning: The article below is over five years old. It may be badly written, poorly considered, immature, obsolete, no longer my opinion, or simply flat-out wrong.

How to customise rotating wallpapers on Ubuntu 13.10

Ubuntu has a nice selection of wallpapers that change throughout the day. But there were a couple that I didn't like, and the GUI doesn't have a way to customise the selection. Here's how I got rid of the images I disliked and added my own to the rotation.

The photos are kept in /usr/share/backgrounds/. This directory turned out to contain a bunch of pretty pictures I'd never seen before — each version upgrade brings a new set, but they're not included in the rotation automatically. There's also no GUI to flip through a set of images throughout the day; you must create a couple of XML files instead. I followed these steps:

  1. Delete any images you don't want from /usr/share/backgrounds.
  2. Create a directory for your custom XML files:
    mkdir ~/.local/share/gnome-background-properties; cd ~/.local/share/gnome-background-properties
  3. Create an XML file that describes a slideshow. I wrote some Ruby to generate the file; you can run it like this:

    ruby generator.rb /usr/share/backgrounds/*.jpg > mywallpapers.xml

    If you've got other files you'd like to include, you can include them as extra arguments before the >:

    ruby generator.rb /usr/share/backgrounds/*.jpg /home/alex/wallpapers/*.jpg > mywallpapers.xml

    If you'd like to create the files by hand, you're mad, but here are the rules:

    • It should have a <starttime> element with a date in the past.
    • It should have pairs of <static> and <transition> elements. The <static> element displays a wallpaper for the set time; the <transition> element crossfades it to the next one. The duration is given in seconds, so each wallpaper displays for 30 minutes.
    • The last element should transition back to the first. This makes the slideshow loop forever.

  4. Create an XML file mywallpaperlist.xml to show your new wallpapers in the appearance properties. Don't forget to change the <filename> property to contain your own home directory. You can use pwd from the terminal to show it if you don't know the correct path.

    <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
    <wallpapers>
      <wallpaper deleted="false">
    <name>My Wallpapers</name>
    <filename>/home/alex/.local/share/gnome-background-properties/mywallpapers.xml</filename>
    <options>zoom</options>
    <pcolor>#2c001e</pcolor>
    <scolor>#2c001e</scolor>
    <shade_type>solid</shade_type>
      </wallpaper>
    </wallpapers>
    

That's it! I didn't have to restart Unity, or jump through any other hoops. If your files are readable and valid XML, then your wallpaper pack should show up if you reopen the appearance properties.