The blog is not really topic specific. I will post random stuff which I find worth sharing. Solutions to little issues, tricks etc.

Wednesday, August 27, 2008

"Animated" desktop wallpaper

A colleague of mine always has a neat satellite image of the north American continent on his desktop as his wallpaper, the desktop background.



So I had to get that too... He actually post-processed the image using ImageMagick do make it darker. Fortunately, I use KDE 3.5.9 (he uses gnome) and let kdesktop blend it with black so make it less intrusive. I actually use a vertical blend, so the image is darker at the bottom, which makes it better for my transparent task bar.

We download the image every twenty minutes and update the wallpaper. Here again, KDE lets me do that easily by using the slide show functionality... A slide show consisting of 1 picture. My desktop always shows the latest satellite picture of North America :)

Then he raised the bar again by archiving all downloaded images. He then rotated through all archived images (past 2 days) and updates the wallpaper every 2 seconds.
Obviously, I had to do that too....

Need two scripts for that

  • The first one is ran as a cronjob, every twenty minutes. It downloads the image, appends a date string to it and checks whether the image has changed (if no, delete the old one).

  • The second script is ran manually and can be sent into the background.
    It loops through all images and sets the wallpaper to the next picture after 2 seconds.


In order to set the wallpaper using a script, I use the dcop call to kdesktop:

dcop kdesktop KBackgroundIface setWallpaper 1 $filename 6

I do that for all 4 desktops. Unfortunately, kdesktop eats my here, so I had to decrease the sleep time between changing pictures from 1 second to 2 seconds.

Does anybody know of a faster way to set the background image?
xsetroot does not work, as the window manager takes control of the background.

As you will notice, the script downloads two other IR images of Eastern Canada and Eastern USA. I was hoping, I could set the image for the left and right head of my monitors individually, however, it seems that the KBackgroundIface does not provide that functionality.

0 comments: