Rawe Rawe Rantas, Malang Malang Putung

Random Wallpaper Changer Shell Script

leave a comment »

Boring with the same wallpaper all day long in your gnome desktop. This simple script will change your gnome desktop wallpaper randomly. Originally taken from here , modified to allow using wallpaper filename that contain spaces and give text output for the randomly choosen wallpaper.

open a text editor, copy and paste this code.
( change the WALLPAPER_DIR to your Wallpaper directory )


## Gnome Random Wallpaper Changer Script
## Originally by
## Modified to fix error when there is a space in wallpaper filename & Add text output ( for conky ) by heri.cahyono{at}

# Wallpaper directory – Change to suit your wallpaper location

# Choose one file randomly
choosenWall=`find $WALLPAPER_DIR -name \*.jpg | sort -R | tail -n 1 | sed “s/ /\\\ /g”`

# File name of selected wallpaper
wallName=`echo $choosenWall | cut -d ‘/’ -f 7`
echo “Current Wallpaper is $wallName”

# Change the wallpaper
/usr/bin/gconftool-2 -t str -s /desktop/gnome/background/picture_filename “$choosenWall”

Save as then make it executable.

chmod +x

That’s it, open terminal and execute the file. You should get your gnome desktop wallpaper changed.

Now, there are some alternative if you want to run this automatically.

1. Create a cronjob to execute the script. let say every one hour.

2. Add to gnome session startup  ( System -> Preferences -> Sessions ). Then add the script on the startup programs. You will get your wallpaper changed every time you login.

3. Add to conky config file using execi to change the wallpaper at specified interval.

${color lightgrey} ${execi 3600 /media/sda5/Appearance/}

Have a nice wallpaper ..

Written by cahbojonegoro

December 11, 2008 at 2:54 pm

Posted in Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: