Feature request ?

houghi houghi at houghi.org
Sat Mar 27 14:40:33 CET 2010


On Sat, Mar 27, 2010 at 06:24:01AM +0100, Mike Massonnet wrote:
> I had like to mention that another way of doing it, which might need less
> resources than a reload action, is to make use of some xfconf voodoo. But you
> had need to make a script and use it as a cron job instead of a simple command
> line. Cron doesn't know about the DBUS address (which is mandatory for running
> xfconf-query), and it usually doesn't have a full PATH like you do in your
> session shell, this is why all of this is done within the script. For such a
> script have a look at http://snipt.org/Hnkh. Save it, make it executable (chmod
> +x ...) and put it in cron like with a line like this:
> 
> */15 * * * * ${HOME}/bin/xfdesktop-refresh.sh

I did the following with multiple monitors:
export DISPLAY=:0.1 && xfdesktop --reload

I also wanted random images, so what I did was first change the desktop
settings. First to have 'Image list' then create a new list and add one
image to it. I created one for each screen.

The I made a script that does the following:
1) Find all the images and place their image locations in a file.
2) Randomize the order of those with `shuf`
3) Select the first line of the file list and place it together with some
extra info in the config file so it looks like:

# xfce backdrop list
/some/dir/image/dir/some_file.jpg

4) Remove the first line from the files list
5) Repeat for each config file
6) run `export DISPLAY=:0.1 && xfdesktop --reload`

Step 1 and 2 are skipped if the file is not empty.

I then put the following line in crontab:
-*      *       * * *   /home/houghi/bin/background > /dev/null 2>&
Yes, I change every minute. :-D The - in the begining is so it won't show
up on logfiles. The end with the > is so I don't get error messages if
things go wrong.

For me it is a nice way of randomizing images. Below the code I use. I
could do a LOT better as code goes, but it works for me. One of the
disadvantages is that it runs even if XFCE is not running.

So here the version of a random screen rotator. Untested as I use some
more stuff in mine and much more then just one location of my images.

#!/bin/bash
#set -x 
# Change the four following lines as needed
IMG_DIR="$HOME/Pictures/1920x1200"
CONF_DIR="$HOME/.config/xfce4/xfconf/xfce-perchannel-xml"
CONF_FILE="$CONF_DIR/xfce4-desktop.xml"
IMG_LIST="$CONF_DIR/images.txt"
# No need to change anything below this
#
# Make the images file. Just needed for the first run
test -f $IMG_LIST || touch $IMG_LIST
# Fill the images file if empty
if [ ! -s $IMG_LIST ]
then
	find $ING_DIR -name "*.jpg" >> $IMG_LIST
	shuf $IMG_LIST $IMG_LIST.bak
	mv $IMG_LIST.bak $IMG_LIST
fi
# Make the config file
FILE=`head -n 1 $IMG_LIST`
cat > $CONF_FILE <<-EOF
# xfce backdrop list
$FILE
EOF
awk 'FNR>1{print}' $IMG_LIST
# Finaly do the reload
xfdesktop --reload


houghi
-- 
But I will accept the rules that you feel necessary to your freedom. I am
free, no matter what rules surround me. If I find them tolerable, I
tolerate them; if I find them too obnoxious, I break them. I am free
because I know that I alone am morally responsible for everything I do.



More information about the Xfce mailing list