I use the "dummy" way and it works, I guess because I added an export of "DBUS_SESSION_BUS_ADDRESS" to the gconftool command, since after upgrading to Lucid gconf-tool sometimes doesn't worked without it. The following script I have running at my mum's machine, so don't wonder. You may well skip the "temp" part, I added it because of some unreliability of the server.
Code:
#!/bin/sh
# Get the pid of nautilus
nautilus_pid=$(pgrep -u $LOGNAME -n nautilus)
# If nautilus isn't running, just exit silently
if [ -z "$nautilus_pid" ]; then
exit 0
fi
# Grab the DBUS_SESSION_BUS_ADDRESS variable from nautilus's environment
eval $(tr '\0' '\n' < /proc/$nautilus_pid/environ | grep '^DBUS_SESSION_BUS_ADDRESS=')
# Check that we actually found it
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
#echo "Failed to find bus address" >&2
exit 1
fi
# export it so that child processes will inherit it
export DBUS_SESSION_BUS_ADDRESS
# delete temp image
rm -f ~/Bilder/WHV-temp.jpg
# get image and save in my HOME
wget -o /dev/null -q -t 3 -T 8 -O ~/Bilder/WHV-temp.jpg http://hotel-seerose.dyndns.org:8001/record/current.jpg
# check if image is valid
if [ -s ~/Bilder/WHV-temp.jpg ]; then
# copy temp image over original image
cp ~/Bilder/WHV-temp.jpg ~/Bilder/WHV.jpg
# reset background with a non-existent image
# if you don't use this, then next line will not update the wallpaper
gconftool -s -t string /desktop/gnome/background/picture_filename /usr/share/backgrounds/dummy.jpg
# load new desktop background image
gconftool -s -t string /desktop/gnome/background/picture_options centered
gconftool -s -t string /desktop/gnome/background/picture_filename ~/Bilder/WHV.jpg
else
# reset background with a non-existent image
# if you don't use this, then next line will not update the wallpaper
gconftool -s -t string /desktop/gnome/background/picture_filename /usr/share/backgrounds/dummy.jpg
# load new desktop background image
gconftool -s -t string /desktop/gnome/background/picture_options scaled
gconftool -s -t string /desktop/gnome/background/picture_filename ~/Bilder/WHV/KW-Brücke-2.jpg
fi
Bookmarks