GNOME Rotate Background Script

Just wrote a little script that rotates my background ever once in a while - as to not get bored!

Save as rotate.sh and make executable

#!/bin/bash

#
# Rotates GNOME Wallpaper using pictures in $FOLDER
# Run in background: ./rotate.sh &
# Make sure there are no spaces in picture filenames
# http://ubuntu.online02.com/node/37
#

FOLDER="/home/phillip/Graphics/Wallpapers/current" # Change to your directory
cd $FOLDER

loop () {
NUMBER=$(ls -1 | wc -l)
RAN=$(($RANDOM%$NUMBER+1))
FILE=$(ls -1 | sed -n ${RAN}p)
echo $FILE
gconftool-2 --set "/desktop/gnome/background/picture_filename" --type string "$FOLDER/$FILE"
sleep 55 # Time between change
loop
}
loop

Then run it in the background, or add it to "Startup Applications"

./rotate.sh &

AttachmentSize
rotate.sh478 bytes

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options