os/linux/ XFCE


xfconf

monitor for changes

xfconf-query -c xfce4-desktop -m

Background Wallpaper

get desktop background

xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS-1/workspace0/last-image

set desktop background (if set to slideshow, it will use the path containing this file

# idiom to avoid explicitly naming a file
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS-1/workspace0/last-image -s $(ls /path/to/wallpapers/*.jpg | head -n1)

my set background script

#!/bin/bash
a="$1"
if [ -n "$a" ]; then
  if [ -d "$a" ]; then
    f="$(ls "$a"/*.jpg | sort -R | head -n1)"
  elif [ -f "$a" ]; then
    f="$a"
  else
    echo "$a" does not exist
    exit 1
  fi
fi
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorLVDS-1/workspace0/last-image -s "$f"