Ubuntu - dynamic background

Dawid Laszuk published on
1 min, 180 words

It should've been easy but it wasn't. To setup a dynamic background, i.e. one that wallpaper between light and dark modes, you need:

  • Two different wallpapers (duh!)
  • Locate where to put a config
  • Write a config into an xml file

Assuming you have light.jpeg and dark.jpeg files in dir /home/user/wallpapers. Create an xml file, e.g. called my_dynamic_wallpaper.xml with the following content

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
  <wallpaper deleted="false">
    <name>My Dynamic Content</name>
    <filename>/home/user/wallpapers/light.jpeg</filename>
    <filename-dark>/home/user/wallpapers/dark.jpeg</filename-dark>
    <options>scaled</options>
  </wallpaper>
</wallpapers>

That xml file should go either to /usr/share/gnome-background-properties (requires sudo) or ~/.local/share/gnome-background-properties. Internet claims different locations, e.g. ~/.local/share/backgrounds. For me, they didn't work. If they don't work for you, manually add an image as a Background, e.g. right click on image and "Set as Background..." and check where it was added. The image should be copied over to some location with name being {dateISO}-{filename}.{fileextension}.