Tuesday, August 11, 2009

Timed Random Wallpapers in Openbox

Finally got a perfect random wallpaper set-up in Openbox! This set-up starts my ~/wallpaper.sh script when I log into Openbox and finds a new (random) wallpaper, every six minutes, from my ~/photos-openbox directory.



while [ 1 ]
sleep 6m



ALIST=( `ls -w1 $WALLPAPERS` )

feh --bg-scale $WALLPAPERS/${ALIST[$SHOW]}


# Programs to launch at startup

numlockx &

xscreensaver &

# Programs that will run after Openbox has started
(sleep 2 && fbpanel) &

#My wallpaper (random wallpaper script - calls wallpaper.sh)
(sleep 3 && /home/steve/wallpaper-loop.sh) &

Very, very nice! Thanks to frisil at the MepisLovers forums for the tip on the infinite loop. I'd spent a lot of time trying to find a way to get a random wallpapers in Openbox; the wallpaper.sh script by itself did this, but adding a line for it in the autostart.sh script only gave me a new wallpaper each time I logged into Openbox. This set-up works about as well as KDE's automatic background changer or GNOME's wallpaper-tray.


Chad said...

Found this script. Great! Except it won't work with files that have spaces in their names. Thought I'd warn people that they'll need to rename their files.

MALsPa said...

Chad, thanks for your comment! I didn't think about that situation -- I don't use spaces in any of my file names, got out of that habit some time ago -- but it's a good thing to know!