2006-11-20

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.

#!/bin/sh
# Update the background.list so the new downloaded wallpapers are available
# to show up in Xfdesktop.
LIST=$HOME/.config/xfce4/desktop/background.list
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.

2 comments:

  1. This is the custom action for Thunar:

    <action>
    <icon>xfce4-display</icon>
    <name>Set as xfdesktop background</name>
    <command>set-xfdesktop-image.sh %f</command>
    <description/>
    <patterns>*</patterns>
    <image-files/>
    </action>

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

    Custom Actions.

    ReplyDelete
  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:

    #!/bin/sh
    [ -z "$1" ] && exit 1
    LIST=$HOME/.config/xfce4/desktop/background.list
    echo "# xfce backdrop list" > $LIST
    echo $1 >> $LIST
    xfdesktop --reload

    ReplyDelete