My friend Keith has done rotating backgrounds on his desktop for a while, and I was thinking today that it would be kind of nice to do that as well.
Step 1: Download some files and put them in a directory: ~/Wallpapers
Step 2: Write a script that picks a file at random and calls xsetbg
Problem 1: xsetbg and KDE don’t get along.
DCOP is the automation language of KDE. It’s also, thanks to kdcop (GUI client) and dcop(1) (command line client) easy to browse available interfaces.
A few minutes of experimentation show that the right invocation is:
dcop kdesktop KBackgroundIface setWallpaper $file 4
the 4 is a magic number that means stretch it to fit the screen while preserving aspect ratio. All the constants (I got as far as 8 before I got bored with the subtle variations):
- center tile
- stretch aspect
- stretch tile
- stretch all
- stretch vertical
Then I put it in crontab, but of course you have to make sure that dcop is in your path (on SUSE, KDE is in its own little sandbox in /opt/kde3/bin) and that you have your DISPLAY set.