Tip: Changing wallpaper in xfce4

Jakob Breivik Grimstveit jakob at grimstveit.no
Tue Apr 27 22:37:45 CEST 2004


Just installed xfce4 on my FreeBSD-box (5.2.1-p4) a couple of days ago
after having used Gnome on both Linux and FreeBSD for at least a couple
of years, and I haven't looked back once - sh*t this is /fast/ :-)

Well, since it worked so nicely for me, here goes a tip back to the
list, as a little «thank you» - how to automatically change the
background wallpaper from time to time:

* find list of pictures, put them in a file
* randomize the list, pick out one of the files
* put it in a specific place (where xfce already looks for a wallpaper)
* run `xfdesktop` which automatically reloads background

Current implementation:

-------------------------------------------------------------------------

relevant crontab entry:

* * * * * ~/bin/newdesktop

-------------------------------------------------------------------------

~/bin/newdesktop:

#!/bin/sh
find /files/pictures/wallpapers/ -type f>/tmp/piclist
~/bin/unsort2 /tmp/piclist
cat /tmp/piclist | head -1 > /tmp/piclist2
cp `cat /tmp/piclist2` ~/files/tmp/wallpaper.img
DISPLAY=:0.0 /usr/X11R6/bin/xfdesktop

-------------------------------------------------------------------------

~/bin/unsort2:

#!/usr/bin/perl

open(FP, "+<$ARGV[0]") or die "Usage: $0 <filename>";

my @arr = <FP>;
seek FP, 0, SEEK_SET;

srand;
while (@arr) {
        print FP splice(@arr, rand @arr, 1);
}

close FP;

-------------------------------------------------------------------------

There you go :-) The most hackish part is the last line of
~/bin/newdesktop - since setting the display limits its usefulness to
single-user-systems running on :0.0 only. Guess I could extract that
info as well somehow(?), but haven't bothered since I'm the only one
using this machine :-)

Hope someone can use this.

Thanks again for a great wm, this rocks! :-)

-- 
Jakob Breivik Grimstveit, http://www.grimstveit.no/jakob, +47 48298152 




More information about the Xfce mailing list