Auto update the background list for Xfdestkop

I have written a quick script to update the list of the images for the background in Xfdesktop.

# Update the background.list so the new downloaded wallpapers are available
# to show up in Xfdesktop.
echo "# xfce backdrop list" > $LIST
find $HOME/images/background/ -type f >> $LIST

Note: change in the last line the folder to the backgrounds.

This script can be either putted in an .zshrc file. Or better, if you use Xfce, save the script, under the name update-desktop-list.sh for example, to your personal bin folder (in my case $HOME/.local/bin) which is correctly set in the PATH, and run xfce4-autostart-editor. You can add the command update-desktop-list.sh.

Finally you have to set up Xfdesktop to use the list (located at $LIST) of backgrounds. Go to Settings > Desktop manager, and select the list as the file. If it doesn't exist run the script a first time.


  1. This is the custom action for Thunar:

    <name>Set as xfdesktop background</name>
    <command>set-xfdesktop-image.sh %f</command>

    ... where the script set-xfdesktop-image.sh is in my personal bin directory properly set in the PATH.

    Custom Actions.

  2. If you want to update only one background, you can use the next script. It updates the background list with only one image passed in argument:

    [ -z "$1" ] && exit 1
    echo "# xfce backdrop list" > $LIST
    echo $1 >> $LIST
    xfdesktop --reload