Ubuntu wallpaper slideshow

The desktop background switcher included with Karmic Koala has a cool feature, a wallpaper slideshow that rotates images at a predetermined interval. However, getting it to cycle through your own set of images isn’t exactly user friendly. In order to get a sequence of images to display, the wallpaper picker must be supplied with an xml file with the following structure:

        1795.0
        /path/to/image1.jpg

        5
        /path/to/image1.jpg
        /path/to/image2.jpg

        1795.0
        /path/to/image2.jpg

        5
        /path/to/image2.jpg
        /path/to/image1.jpg

Where all paths are absolute. The xml file can be chosen as a wallpaper in the standard gnome wallpaper picker by going pressing add and choosing “All files” from the file filter drop down.

To make the process of creating these xml files a bit simpler, I made a python script that takes all images in a directory and generates an xml file for them. To use it, simply run it in the directory where the images are located and it will generate a file called “desktop.xml”. The default transition time is 1795 seconds (30 minutes). To change the switch time, supply the new interval in seconds as an argument:

./ubuWallGen 1200

You can get the latest version of the script using git:

git clone git://github.com/royvandewater/ubuWallGen.git

You can also download the script directly here

9 thoughts on “Ubuntu wallpaper slideshow

  1. Great post!

    I’d suggest adding that you have to select desktop.xml as the selected wallpaper in “Change Desktop Background”, as I had to go to another site to find out how to use the XML file.

    Thanks!

  2. Tweaked your file to get images in alphanumeric order. Commented out one line, two lines added.

    “”” dirlist = os.listdir(os.getcwd()) “””

    dirlist = sorted([d for d in os.listdir(os.getcwd()) if os.path.isdir(os.getcwd() + os.path.sep + d)])
    dirlist.extend(sorted([f for f in os.listdir(os.getcwd()) if os.path.isfile(os.getcwd() + os.path.sep + f)]))

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>