Random Wallpaper

I was tired of staring at an LCD all day while it is sunny and blue skies outside. To tide me over until vacation, I downloaded some landscape photos and scripted my wallpaper to rotate randomly.

/home/brett/bin/random-wallpaper

#!/bin/bash
DIR=$HOME/Pictures/wallpaper
WALLPAPER=$( ( for i in `ls $DIR`; do
    echo $RANDOM $i
  done
) | sort | sed -r 's/^[0-9]+ //’ | head -1 )
gconftool -t string -s /desktop/gnome/background/picture_filename $DIR/$WALLPAPER

Crontab:

*/3 * *   *   *   /home/brett/bin/random-wallpaper

Credits to:

http://hivearchive.com/2007/10/18/bash-one-liner-to-randomize-lines-in-file/

http://joeamined.wordpress.com/2008/02/15/automatically-changing-wallpaper-relatively-to-daytime-in-ubuntu/