Create custom wallpaper slideshows in GNOME

A very cool, yet lesser known, feature in GNOME is its ability to display a slideshow as your wallpaper. You can select a wallpaper slideshow from the background settings panel in the GNOME Control Center. Wallpaper slideshows can be distinguished from static wallpapers by a small clock emblem displayed in the lower-right corner of the preview.

Some distributions come with pre-installed slideshow wallpapers. For example, Ubuntu includes the stock GNOME timed wallpaper slideshow, as well as one of Ubuntu wallpaper contest winners.

What if you want to create your own custom slideshow to use as a wallpaper? While GNOME doesn’t provide a user interface for this, it’s quite simple to create one using some simple XML files in your home directory. Fortunately, the background selection in the GNOME Control Center honors some common directory paths, which makes it easy to create a slideshow without having to edit anything provided by your distribution.

Getting started

Using your favorite text editor, create an XML file in $HOME/.local/share/gnome-background-properties/. Although the filename isn’t important, the directory name matters (and you’ll probably have to create the directory). For my example, I created /home/ken/.local/share/gnome-background-properties/osdc-wallpapers.xml with the following content:

<?xml version=“1.0” encoding=“UTF-8”?>
<!DOCTYPE wallpapers SYSTEM “gnome-wp-list.dtd”>
 <wallpaper deleted=“false”>
   <name> Wallpapers</name>

The above XML file needs a <wallpaper> stanza for each slideshow or static wallpaper you want to include in the backgrounds panel of the GNOME Control Center.

In this example, my osdc.xml file looks like this:

<?xml version=“1.0” ?>
    <!— Duration in seconds to display the background —>
    <!— Duration of the transition in seconds, default is 2 seconds —>

There are a few important pieces in the above XML. The <background> node in the XML is your outer node. Each background supports multiple <static> and <transition> nodes.

The <static> node defines an image to be displayed and the duration to display it with <duration> and <file> nodes, respectively.

The <transition> node defines the <duration>, the <from> image, and the <to> image for each transition.

Changing wallpaper throughout the day

Another cool GNOME feature is time-based slideshows. You can define the start time for the slideshow and GNOME will calculate times based on it. This is useful for setting different wallpapers based on the time of day. For example, you could set the start time to 06:00 and display one wallpaper until 12:00, then change it for the afternoon, and again at 18:00.

This is accomplished by defining the <starttime> in your XML like this:

    <!— A start time in the past is fine —>

The above XML started the animation at 06:00 on November 21, 2017, with a duration of 21,600.00, equal to six hours. This displays your morning wallpaper until 12:00, at which time it changes to your next wallpaper. You can continue in this manner to change the wallpaper at any intervals you’d like throughout the day, but ensure the total of all your durations is 86,400 seconds (equal to 24 hours).

GNOME will calculate the delta between the start time and the current time and display the correct wallpaper for the current time. For example, if you select your new wallpaper at 16:00, GNOME will display the proper wallpaper for 36,000 seconds past the start time of 06:00.

For a complete example, see the adwaita-timed slideshow provided by the gnome-backgrounds package in most distributions. It’s usually found in /usr/share/backgrounds/gnome/adwaita-timed.xml.

For more information

Hopefully this encourages you to take a dive into creating your own slideshow wallpapers. If you would like to download complete versions of the files referenced in this article, they can be found on GitHub.

If you’re interested in utility scripts for generating the XML files, you can do an internet search for gnome-background-generator.