Kod: Označi sve
#!/bin/bash
# by lcj@klonex.com.pl © 2002.10.22
# thanks goes to: Cegla@klonex.com.pl, star @ #gnome-art
# Purpose: Change randomly wallpaper in Gnome, if 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 interned 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
# DODANO
cd .gnome2
rm backgrounds.xml
# KRAJ DODANOG
# CHANGE THE DIR BELOW TO YOUR WALLPAPER DIRECTORY:
####################################################
WALLPAPERS_LOCATION="/home/davor/Slike/Desktop/"
####################################################
# 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
# minjano
RANDOM=$(date +%s)
which_pic=$[($RANDOM % ile)]
# we have to decrease it a bit. It won't be that random now (IMG:http://mandrivausers.org/style_emoticons/default/smile.gif)
#while [ $which_pic -gt $ile ]
#do
#((which_pic=$which_pic / 2))
#done
# set $ update the wallpaper
gconftool-2 --type string --set /desktop/gnome/background/picture_filename ${pic[$which_pic]}}