#!/bin/bash #Change the backgrounds on all of the screens that I have connected to my computer. See the code for more information #set -x . /home/default LOCKFILE PROGRAMS "xfdesktop" #Parameters#{{{ IMG_DIR="$HOME/Pictures" CONF_DIR="$HOME/.config/xfce4/xfconf/xfce-perchannel-xml" CONF_FILE="$CONF_DIR/xfce4-desktop" WALLPAPER_LIST="$IMG_DIR/images.txt" test -f $WALLPAPER_LIST || touch $WALLPAPER_LIST #}}} # Fill the file if it is empty {{{ CHECK_LIST () { if [ ! -s "$WALLPAPER_LIST" ] then # Put all the files in the file (yep Ashley is in there twice) for FILES in 1920x1200 processed 1600x1200 1600x1200/women/a/ashley_judd # for FILES in 1920x1200 processed 1600x1200/women/a/ashley_judd do find -L $IMG_DIR/$FILES -name "*.jpg" >> $WALLPAPER_LIST done #Randomize the order shuf $WALLPAPER_LIST -o $WALLPAPER_LIST.bak mv $WALLPAPER_LIST.bak $WALLPAPER_LIST fi } #}}} # New Image {{{ NEW_IMAGE () { FILE=`head -n 1 $WALLPAPER_LIST` grep $FILE -v $WALLPAPER_LIST > $WALLPAPER_LIST.bak mv $WALLPAPER_LIST.bak $WALLPAPER_LIST echo "# xfce backdrop list $FILE" > ${CONF_FILE}${COUNT}.xml } #}}} #The script#{{{ for COUNT in `seq 1 3` #change 1 to number of screens do CHECK_LIST NEW_IMAGE done export DISPLAY=:0.0 && xfdesktop --reload RUN=`pidof xfdesktop` if [ "$RUN" == "" ] then export DISPLAY=:0.0 && xfdesktop & fi #}}}