Random desktop background

Well, I have a directory with a bunch of backgrounds, and I like to have it change pretty often because I get bored with the scenery :) . So I figured I would make a script to randomly select an image and change the background. Then I added it to the crontab so now I have a different background every hour.

All you need is to change /home/gerard/wpaper with whatever your directory is.

#/bin/bash
imagedir=/home/gerard/wpaper
count=`ls $imagedir|wc -l`
let “pick = $RANDOM % $count”
let “pick += 1″
image=`ls $imagedir|sed -n “$pick”p`
Esetroot -scale $imagedir/$image

Comments are closed.