# # Created by Peter A. Murray # peteruta-AT-yahoo-DOT-com # Pick a random jpg for the Gnome desktop background # # Walk a tree looking for jpg files and pick one at random. Use that file as the wallpaper for the desktop. # My picture files are in many sub dirs and all the little hack I saw used a single dir to get the image. # So I wrote the following little bash script. # Put it in .bash_profile if you want a new wallpaper everytime you open a new bash :) # choose input tree # export BACKGROUND_DIR=~/Desktop/bild/2005 #export BACKGROUND_DIR=~/Desktop/bild/2006/Winter-Jan # build up the array array1=( `find "$BACKGROUND_DIR" -name *.jpg | tr 'n' ' '`) element_count=${#array1[*]} arrayPos=$RANDOM # get a random number less than length of array let "arrayPos %= $element_count" picToUse=${array1[$arrayPos]} # set the background image /opt/gnome/bin/gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$picToUse"