[Pkg-xfce-devel] Bug#524561: Wrote script to change the wall paper

Chris Dos chris at chrisdos.com
Sat Apr 18 04:51:09 UTC 2009


I found a way to change the wallpaper from the command line.  So I modified a script that I made to change the
wallpaper in e17.  I still think this is a bug, but this might be useful to others out there that are having
the same problem:

<- Begin Script ->
#!/bin/bash

export PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"

ROTATEDELAY=120

WORKDIR=/tmp/.rotate_wallpaper

FILELIST=$WORKDIR/.imagefiles

# Location of the directories of your image files.
IMAGEFILES="$HOME/Images/1920x1200_Wall_Wapers \
		$HOME/Images/Aircraft \
		$HOME/Images/Animals	\
		$HOME/Images/Astronomy \
		$HOME/Images/Cars \
		$HOME/Images/DigitalBlasphemy \
		$HOME/Images/Fantasy \
		$HOME/Images/LinuxWallPapers \
		$HOME/Images/Scenery \
		$HOME/Images/Sci-Fi \
		$HOME/Images/Second_Nature \
		$HOME/Images/Ships"


if [ ! -d $WORKDIR ]
then
	mkdir $WORKDIR
fi

if [ -e FILELIST ]
then
	rm -f FILELIST
fi

# Build file list
for I in $IMAGEFILES
do
	find $I -type f \( -name '*.jpg' -o -name '*.png' -o -name '*.gif' \)>> $FILELIST
done

# Load list of images into array and remove unneeded file.
oIFS=$IFS IFS=$'\n' LINES=($(<"$FILELIST")) IFS=$oIFS
rm $FILELIST


# Pick random image, set the background, and loop forever.
cd $WORKDIR
while :
do
	n=${#LINES[@]}
	r=$((RANDOM % n))
	IMAGE="`echo ${LINES[r]}`"
	xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ""
	xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${IMAGE}"
	sleep $ROTATEDELAY
done
<- End Script ->


	Chris





More information about the Pkg-xfce-devel mailing list