XML background doesn't load image

Was going to log an issue in the GitLab tracker, but first wanted to see if this was user error.

I’ve crafted an XML wallpaper for hourly screen transitions and then referenced it using another XML under ~/.local/share/gnome-background-properties. When viewed in settings, it comes up as a black image (or uses the scolor, essentially ignores/doesn’t load the file). When selected, it similarly doesn’t display an image, just the scolor. Same result when loading directly from Gnome Tweaks.

Affected version

Currently using distro supplied XOrg.

VERSION="20.10 (Groovy Gorilla)"

Linux * 5.8.0-33-generic #36-Ubuntu SMP Wed Dec 9 09:14:40 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

GNOME Shell 3.38.1

Steps to reproduce

  1. Download the following file:


  1. Create an XML file with the following contents (updating the tag to point to the saved file). This is a stripped down version of what I was trying to load.
  1. Using Gnome Tweaks, load by going to AppearanceBackgroundImage. This is a quicker way of seeing outcome (and validates that there isn’t anything else impacting outcome), however can also load by creating an XML file in ~/.local/share/gnome-background-properties/ with the below content and then selecting in SettingsBackground.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
  <wallpaper deleted="false">

Have tested by disabling all extensions through tweak tool, restarting Gnome (Alt-F2, R) and loading settings again. No success.

Have successfully loaded the file directly without the XML, this works.

Successfully loaded a dynamic wallpaper using source at:

This is really puzzling me. Any thoughts why this simple XML file won’t work?

No suggestions from anyone?

Convert all relative file paths to absolute form. First of all, manually change the tilde sign “~” to the current user’s home directory, because this usually causes troublesome behavior in the applications.

(After each modification of the XML slideshow file, you need to restart the Gnome to make the changes visible on the desktop.)

No luck unfortunately :frowning:

Weird. I reproduced exactly the same symptoms according to your guidelines (no preview in Settings, no desktop background). Using full paths fixed everything. :thinking:

Maybe it’s a different kind of error - a typo (for example “0.jpeg” instead of “0.jpg”), illegal character in XML syntax (like ampersand “&”), invalid filename (missing extension “.xml”), etc. ?

Could you show the current contents of your stripped down version of xml file from step 2 (with absolute path in file tag), and specify its filename with location (full path to this file)?


<?xml version="1.0" encoding="UTF-8"?>

Have tried various things with that format, such as paths, file types, changing/removing the XML decleration. Really has me puzzled.

Ok. Let’s test it without apps.

Save the file you showed as:

So this is an image from “file” tag:

Then try this commands in terminal:

  1. set the default desktop background (in Ubuntu 20.10 it is a gorilla)
    gsettings reset org.gnome.desktop.background picture-options
    gsettings reset org.gnome.desktop.background picture-uri

  2. set image as background, copy-paste path from xml file tag (aurora show up)
    gsettings set org.gnome.desktop.background picture-uri "/home/nick/Pictures/DynamicWallpapers/adi1090x-dynamic-wallpapers/aurora/0.jpg"

  3. again reset desktop background (gorilla again)
    gsettings reset org.gnome.desktop.background picture-uri

  4. set xml as background (aurora should show up again)
    gsettings set org.gnome.desktop.background picture-uri "/home/nick/simple.xml"

So, everything runs as you would expect perfectly! Just compared the two files (I.e. simple.xml and the original aurora.xml) and noticed:

nick > file /home/nick/Pictures/DynamicWallpapers/adi1090x-dynamic-wallpapers/aurora/aurora.xml 
/home/nick/Pictures/DynamicWallpapers/adi1090x-dynamic-wallpapers/aurora/aurora.xml: XML 1.0 document, UTF-8 Unicode (with BOM) text

nick > file simple.xml 
simple.xml: XML 1.0 document, ASCII text

Suspect it could be something to do with the encoding that I don’t know about?

This most likely is caused by your aurora.xml file having a BOM, which confuses the tool reading the file. BOMs have this tendency, because a lot of apps don’t expect them and thus recognize them as weird garbage. You should try removing the BOM and see if it’s working better.

Removing the BOM is not necessarily easy in your favorite editor, but you’ll probably have an option to do so somewhere. Alternatively, you can use sed: sed '1s/^\xEF\xBB\xBF//' -i aurora.xml.

Yep, that’s what it is - running the two files through hexdump and that’s the only difference. Feel silly around such a trivial thing.

Thanks all for the assistance.

Edit: Interesting that this doesn’t seem to be an issue for the file located in ~/.local/share/gnome-background-properties (which also has the BOM). Are they read in by two different parsers?

That’s right.

  1. advanced parser in libxml2 - Gnome Settings use this parser to handle xml files in gnome-background-properties

  2. simple parser in GLib (via libgnome-desktop) - Gnome Shell and Gnome Settings use this parser to read slideshow / dynamic background xml file (Shell to display background on desktop, Settings to generate background preview in GUI)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.