Shuffle your background images

Want a cool way to shuffle your backgrounds everytime you restart? Well look no further. This handy dandy little script seems to work great. What you need to do is point the Backgrounds preferences panel at a particular image, then use this script to suck a random image out of another directory and overwrite the image Backgrounds is pointing to every time you reboot.
First make a copy of one of your backgrounds and call it something like „background.jpg“. Put it in a directory where you can pretty much ignore it, like „/boot/home/config/settings„.
Now you need to set your background in the preferences to „/boot/ home/config/settings/background.jpg„.
Next, drop all the backgrounds you want to appear in rotation into a single directory. This script assumes that location is /boot/home/Backgrounds.
Ok, now the easy part, edit your „userBootscript“ file and add the following code:

	N=`date +%S`
	N=`expr $N + 0`
	I=0
	for file in /boot/home/Media/Backgrounds/*
	do
		I=$[$I + 1]
	done
	N=$[($I * $N) / 60]
	for file in /boot/home/Media/Backgrounds/*
	do
		if [ $N -eq 0 ]
		then
			cp $file /boot/home/config/settings/background.jpg
			break
		fi
		if [ $N -ne 0 ]
		then
			N=$[$N - 1]
		fi
	done

You will need to change „/boot/home/Media/Backgrounds“ to your background folder, and then after you restart twice, you’ll be all set.

 

Comments

No comments so far.

(comments are closed)

Kategorien

 
 
Blogroll
Resources