#!/bin/bash # by lcj (c) 2002.10.22 # thanks goes to: Cegla, star @ #gnome-art # Purpose: Change randomly wallpaper in Gnome, when nautilus is set to draw desktop # Usage: change the value: WALLPAPERS_LOCATION to directory with wallpapers, # remember the / at the end. There should be no other files than the # pictures intended for wallpaper in that directory # version: 0.2 # history: # 22-Oct-2002, version 0.2 Initial release # 22-Oct-2002, changed to work with pictures from given directory # 14-May-2003, finaly got a real RANDOM NUMBER! # # CONFIGURATION # CHANGE THE DIR BELOW TO YOUR WALLPAPER DIRECTORY: #################################################### WALLPAPERS_LOCATION="/home/lukasz/Graphics/wallpapers/" #################################################### # END OF CONFIGURATION # main code, lets enter the directory cd $WALLPAPERS_LOCATION # counting number of files ile=`ls | wc -l | tr -d "[ ]"` #reset counter to 1 counter=1 # now get every file name and put it ino pic[licznik] table for i in `ls` do pic[counter]=${WALLPAPERS_LOCATION}$i ((counter=counter+1)) done # now lets get the RANDOM number which_pic=$(($RANDOM % $ile)) # set $ update the wallpaper echo $which_pic gconftool-2 --type string --set /desktop/gnome/background/picture_filename ${pic[$which_pic]}