|
Written by Shaniur T I M Nabi
|
|
Friday, 24 March 2006 |
This script enables you to have a different set of wallpaper each time
you login. This works if you are using fvwm2 as your window manager.
Step 1 (Setup all wallpapers):
- Make sure all wallpapers are in one directory
- The wallpapers must be named in the following manner:
| First wallpaper must be wall.jpg
Second wallpaper - wall0.jpg
Third wallpaper - wall1.jpg
Fourth wallpaper - wall2.jpg
.
.
.
Wall paper no 100 - wall98.jpg
.
.
Wall paper no N - wall[N-2].jpg |
Step 2 (Setup .xsession):
Your .xsession file runs a script that randomly picks a file from the
available wallpapers. The .xsession file should look something like
this:
#!/bin/sh
file=`/path/to/home/scriptLocation/randomWallChooser.sh`
# Any other setting that you may want to have goes here
# The following line lauches the wallpaper.
# NOTE: You must have xv installed and check the path to xv
/usr/local/bin/xv -root -max -viewonly -quit $file
Step 3 (Code of the script that chooses a random wallpaper):
#!/bin/sh
# Author: T I M Shaniur Nabi
# Contact: http://www.shaniur.com/contact
# Date: 20th March 2004
#
# This scripts helps you to select wallpapers at random from your wallpaper
# directory. This is the file what should be executed from your .xsession
# file.
#
# Desktop should be running fvwm2
#
# NOTE: Your wallpapers must be named in the following format.
#
# First wallpaper must be wall.jpg
# Second wallpaper - wall0.jpg
# Third wallpaper - wall1.jpg
# Fourth wallpaper - wall2.jpg
# .
# .
# .
# Wall paper no 100 - wall98.jpg
# .
# .
# Wall paper no N - wall[N-2].jpg
PATH_OF_WALL_DIRECTORY=/path/to/home/wall # Path to the directory
# where all the wallpapers are
# stored.
NUMBER_OF_WALL_PAPERS=6 # Total number of wallpapers that are
# there in your wallpaper directory.
################# DO NOT EDIT ANYTHING BELOW ###################
mulFactor=`echo "$NUMBER_OF_WALL_PAPERS - 1" | /usr/bin/bc`
# Generate randon number
number=`/usr/local/bin/awk 'BEGIN {srand();print rand()}'`
# Generate appropriate integer from the random number
number=`echo "$number * $mulFactor" | /usr/bin/bc`
int=`echo $number | /usr/local/bin/awk -F. '{print $1}'`
# Generate file name and export it to .xsession
file=`echo $PATH_OF_WALL_DIRECTORY/wall`
file=`echo $file$int.jpg`
echo $file
########## END OF SCRIPT ###########
Add as favourites (5) | Quote this article on your site | Views: 693
Powered by AkoComment Tweaked Special Edition v.1.4.6 AkoComment © Copyright 2004 by Arthur Konze - www.mamboportal.com All right reserved |