# Slowly changing the background in XFCE



Google is always helpful of course, so I've found [this blog entry](
http://s7dhansh.blogspot.com/2007/04/xfce-as-desktop-and-random-desktop.html)
on how to set the background in [xfce](http://www.xfce.org).

It boils down to setting a `jpg` in XFCE's backdrops.list and then
reloading `xfdesktop`. Crude, but it works.

This can de done with the following command:

    cat <<EOF > ~/.config/xfce4/desktop/backdrops.list
    # xfce backdrop list
    background.jpg
    EOF

And then

    xfdesktop --reload 

However when running from CRON it is more easy to do a 
`killall -USR1 xfdesktop`.

A collage from ATComputing, [Jacques loonen](http://www.jacquesloonen.com) 
had a little script that will download a nice image from some site showing
the earth with actual clouds rendered on it. I'm going to use it to
make a background that slowly changes from day into night and vice
verse.

The following script wil be run from cron, it will generate a new
`jpg` suitable for background use. Images from 
[opentopia.com](http://www.opentopia.com/images/cams/world_sunlight_map_rectangular.jpg)
are particularly nice.

    #!/bin/sh
    IMG=/home/miekg/tmp/xfce_bg.jpg
    wget \
    http://www.opentopia.com/images/cams/world_sunlight_map_hemisphere.jpg \
    -O $IMG 
    # not really needed, but... heh
    cat <<EOF > ~/.config/xfce4/desktop/backdrops.list
    # xfce backdrop list
    $IMG
    EOF
    killall -USR1 xfdesktop 

The `# xfce backdrop list` comment seems to necessary to make it all work.

# CRON
`CRON` is the most natural fit to download new images. So save the
script to a place where it can be found, say in `~/bin/xfcebg` and
edit your user cron entry with `crontab -e` and put something like
this in there

	*/5 * * * *       $HOME/bin/xfcebg

That's it!

# Didn't like it
The whole scaling seems to be a bit off and the earth image is way too
white, so I'm already back on my go'old background :-)

