Thursday, August 27, 2009

Timed Random Wallpapers in Fluxbox

I've always like both Openbox and Fluxbox, but neither of them come with an automatic wallpaper changer. The one that comes with KDE is great; in GNOME, I use the wallpaper-tray application, which can be installed with Synaptic. I missed having a feature like that whenever I switched over to Openbox or Fluxbox.

I wrote about how I got an automatic wallpaper changer going in Openbox in this earlier post. I figured I could use a similar approach for my Fluxbox installation in Mepis 8.

In Fluxbox, I use feh, and I can run the following command from a terminal to get a random wallpaper:

fbsetbg -r [path to directory containing backgrounds]

So I started out with a wallpaper-loop.sh script similar to the one I'd used in Openbox:

~/wallpaper-loop.sh

#!/bin/bash

while true
do
fbsetbg -r /home/steve/.fluxbox/backgrounds
sleep 360
done


Then I created ~/.fluxbox/autostart.sh:

~/.fluxbox/autostart.sh

#!/bin/bash

/home/steve/wallpaper-loop.sh


Next, I edited this line in the ~/.fluxbox/init file:

session.screen0.rootCommand: ~/.fluxbox/autostart.sh


For reasons I can't explain, this procedure worked to give me random wallpaper changes, but I was getting them at odd intervals -- every few minutes instead of every 6 minutes like I'd specified. That problem seemed to fix itself once I rebooted the computer.

So, it works fine here! Now I can enjoy random, automatic wallpaper changers in Openbox and Fluxbox like I do in KDE and GNOME!

No comments: