Jump to content

Nautilus & GNOME 2.0: How to change wallpaper on the fly


Guest lcj
 Share

Recommended Posts

Hi!

 

I've been working with GNOME 1.4 now it's time for 2.0. I noticed that if you set nautilus to draw your background I cannot change my wallpaper any more.

So after asking about gnomeconf-2 at #gnome-art (irc.gnome.org) I've written very simple script.

 

HOW TO USE IT:

 

1. Put all your favourite wallpapers into one directory

2. Set this directory inside script.e/

3. Run it :)

 

I've done this via cron job:

 

$crontab -e

and put:

0-59/5 * * * * /home/user/bin/wallpaper_changer_script

 

TO DO:

Random value shoud me calculated in different way... Any ideas ?

 

The script:

 

---cut here---

#!/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

 

# CHANGE THE DIR BELOW TO YOUR WALLPAPER DIRECTORY:

####################################################

WALLPAPERS_LOCATION="/home/lcj/Graphics/wallpapers/"

####################################################

# 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

which_pic=$RANDOM

# we have to decrease it a bit. It won't be that random now :)

while [ $which_pic -gt $ile ]

do

((which_pic=$which_pic / 10))

done

# set $ update the wallpaper

gconftool-2 --type string --set /desktop/gnome/background/picture_filename ${pic[$which_pic]}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...