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.
~/wallpaper-loop.sh
#!/bin/bash
while [ 1 ]
do
/home/steve/wallpaper.sh
sleep 6m
done
~/wallpaper.sh
#!/bin/bash
WALLPAPERS="$HOME/photos-openbox"
ALIST=( `ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[*]}
SHOW=$(( $RANDOM % $RANGE ))
feh --bg-scale $WALLPAPERS/${ALIST[$SHOW]}
~/.config/openbox/autostart.sh
# Programs to launch at startup
#numlock
numlockx &
#screensaver
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.

0 Comments