generate‐wallpaper‐xml - yktoo/yktools GitHub Wiki

Creates an XML wallpaper description file for GNOME or Ubuntu.

There is another script of similar functionality in this collection, rotate-wallpaper, which sets a random image file as desktop wallpaper. It has only one downside: you have to run it every time you want to rotate your wallpaper.

However GNOME since 2.28 allows assigning a slide show as wallpaper by providing an image list in XML format. There you can specify the order and duration for each image. Moreover, you can even define a transition from one image to another.

So I decided to create a simple script that generates an XML file for a given set of images and, optionally, sets that as the current wallpaper. It requires GNOME 3+ or Ubuntu (11.10 or later).

Synopsis

generate-wallpaper-xml [options] pictures_dir xml_file

Where:

  • options Any combination of the following:
    • -d <number> Override default display duration (1795 seconds, ca. half an hour)
    • -s <mode> Sort the files according to mode, whose values are:
      • name Sort by file path and name
      • shuffle Randomize file order
    • -t <number> Override default transition duration (5 seconds). If 0, no transition is used
    • -v Verbose output
    • -w Set the generated XML file as current wallpaper
  • pictures_dir Path to directory with pictures
  • xml_file Path to the output XML file

Usage examples

  1. Create the file wallpapers.xml in the Pictures subdirectory (in the user's home directory) from picture files from the same subdirectory:
generate-wallpaper-xml ~/Pictures ~/Pictures/wallpapers.xml
  1. The same as above, but additionally set the generated file as the current wallpaper:
generate-wallpaper-xml -w ~/Pictures ~/Pictures/wallpapers.xml
  1. The same as previous, plus set display duration of each file to 10 minutes (600 seconds), and disable transitions between images:
generate-wallpaper-xml -w -d 600 -t 0 ~/Pictures ~/Pictures/wallpapers.xml
  1. The same as previous, plus shuffle the file list so that they are ordered randomly:
generate-wallpaper-xml -w -s shuffle -d 600 -t 0 ~/Pictures ~/Pictures/wallpapers.xml

See also

⚠️ **GitHub.com Fallback** ⚠️