This simple tutorial shows how to turn your photos as desktop slideshow by manually creating XML file in Ubuntu 20.04 and Ubuntu 22.04 LTS.
If you’re just looking for an automatic wallpaper changing software, here are four other choices.
In Ubuntu with the default GNOME desktop, user may turn photos into wallpaper slideshow by creating a XML file, then select it at any time in the Background settings.
XML slideshows in Background settings are displayed with a small clock emblem in the lower-right corner of the preview. (See the red rectangle area in the picture)
NOTE: In Ubuntu 22.04, changing wallpaper or slideshow only applies in current color scheme. Switching to Light or Dark mode, also changes the wallpaper setting.
Step 1: Create & Edit XML file for slideshow:
First of all, you have to create a XML and write the rules for which photos to display as slideshow, how long they will be displayed, and the transition orders.
1. Create XML file
You can create the XML files in anywhere of your user folder. Though it recommends for software developers to put them in ‘~/.local/share/backgrounds
‘ folder.
Here I created a sub-folder called ‘slideshows‘ under my Pictures folder. Then, create an empty document and re-name it as .xml
file.
2. Edit XML write the rules:
After created the file, open it with your favorite text editor and write something look like:
<?xml version="1.0" ?> <background> <static> <duration>60.0</duration> <file>/home/ji/Pictures/Wallpapers/Pic1.jpg</file> </static> <transition> <duration>0.5</duration> <from>/home/ji/Pictures/Wallpapers/Pic1.jpg</from> <to>/home/ji/Pictures/Wallpapers/Pic2.jpg</to> </transition> <static> <duration>300.0</duration> <file>/home/ji/Pictures/Wallpapers/Pic2.jpg</file> </static> <transition> <duration>0.5</duration> <from>/home/ji/Pictures/Wallpapers/Pic2.jpg</from> <to>/home/ji/Pictures/Wallpapers/PicN.png</to> </transition> <static> <duration>60.0</duration> <file>/home/ji/Pictures/Wallpapers/PicN.png</file> </static> <transition> <duration>0.5</duration> <from>/home/ji/Pictures/Wallpapers/PicN.png</from> <to>/home/ji/Pictures/Wallpapers/Pic1.jpg</to> </transition> </background>
The file content is easy to read. It starts with <?xml version=”1.0″ ?>
, then follows with a <background></background>
node.
With in <background>
node, you can add as many <static></static>
and <transition></transition>
nodes as you can depends on number of wallpaper files.
While the <static>
node contains display time (in seconds) and path to the picture file, the <transition>
contains transition time and from to file paths.
TIP: You may drag and drop your photo files into Terminal (Ctrl+Alt+T) or web browser’s URL bar to get the file path quickly!
Step 2: Make the XML slideshow visible in Background settings
After created a XML file, you have to create another one to make it visible in system settings utility.
1. First, press Ctrl+Alt+T on keyboard to open a terminal window. When it opens, run command to create the local background properties directory:
mkdir -p ~/.local/share/gnome-background-properties
Then open that directory in file manager by running command:
nautilus ~/.local/share/gnome-background-properties
2. When the folder opens, create empty file and rename it to a .xml file with whatever filename as you want.
3. Finally open the new created XML file and paste following lines:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd"> <wallpapers> <wallpaper> <name>Ji's slideshow</name> <filename>/home/ji/Pictures/slideshows/myslideshow.xml</filename> <options>zoom</options> <pcolor>#2c001e</pcolor> <scolor>#2c001e</scolor> <shade_type>solid</shade_type> </wallpaper> </wallpapers>
Here type whatever name within <name></name>
node, and set the full path to the previous created XML with <filename></filename>
node.
After saving the file, open or re-open ‘Background’ settings, you should see the new created background slideshow.
Summary:
In short, you can create a XML file in anywhere of user folder, write the rules to specify which photos to display, how long they will persist, and the transition order. Then, create another XML file in background properties directory to make the slideshow visible in ‘Background’ settings dialog.
In theory, the XML should work on all GNOME based Linux, e.g., Fedora Workstation, though I only tested it in Ubuntu 20.04 and Ubuntu 22.04.
Hi Ji
Funny that you should pick this particular subject.
I have more than 4000 pictures which are in carefully named and organized hierachical directories. So recently I wrote a little program which traversed the directories and wrote all the file names into an xml file as you describe. But this doesn’t work, because apparently they need to all be in same directory. Is there any way around this?
Thanks for all the useful information you’ve provided over the years. Stay well.
Tony
It works for me with photo images in different folders. If you have pictures outside user home, instead of .local/share/gnome-background-properties, try creating the rule in /usr/share/gnome-background-properties directory to make your XML visible.
And there’s a graphical tool that may help:
https://flathub.org/apps/details/com.github.maoschanz.DynamicWallpaperEditor
Very useful post.
I was looking for a method to get a slideshow working with Regolith.
I made a little script to generate the background XML: https://github.com/imbodensamuel/ubuntu-sideshow-wallpaper
I notice I am no the first one hehe.
Works with multiple folders
Hello
Is there a way of using a single html file as wallpaper?
This worked beautifully when I was on 16.04, but now that I’ve upgraded to 20.04-4 Background won’t allow me to add an .xml, only recognized graphics extensions. I found a way to add it using ‘gsettings set org.gnome.desktop.background picture-uri file:////path/to/file.xml’, which shows the slideshow, but does not add it to Backgrounds. If I switch, then want to switch back, I have to do it from the command line again.
Hi,
any chance the method being adapted for Ubuntu 22.04 ?
So far I couldn’t manage to get the slidewhow(s) displayed in « settings / background » :
https://answers.launchpad.net/ubuntu/+source/gnome-control-center/+question/702179
( french, with screenshots ) https://forum.ubuntu-fr.org/viewtopic.php?id=2072487
Thanks !
Fresh in using Linux system. Your website is very helpful. Thank you!
The slideshow following the tutorial works great with 22.04.