www.mamboteam.com
Cyberhome of Shaniur I'm watching you...
Home arrow Code Library arrow Shell Scripts arrow fvwm2 - Random Wallpaper
Wednesday, 23 May 2012
 
 
Shaniur.Com
Home
About Shaniur
Music
Fun House
Code Library
Guestbook
Links
Search
Contact Me
To Do List...
Login
Who's Online
We have 27 guests online
Archive
Get Thunderbird!
---
Get Firefox!
---
Get Firefox 3 
---
Syndicate
Lastest Comments
Bangla Music Video from YouTub...
null
i am very good ;) :upset :) ;)
31/12/11 08:00 More...
By arun robin manna

Bangla Music Video from YouTub...
null
i am very good
31/12/11 07:57 More...
By arun robin manna

April '08 Top 10
[B]null[/B][*]maruf
26/11/11 15:58 More...
By mahmud hasan Maruf

Registration is Open
Need Srooth Album
Hi, Shaniur, please you can upload band album (Srooth) by p...
22/10/11 12:56 More...
By Md. Kamrul Hasan

Bangla Music Video from YouTub...
mollick
[I]null[/I][U][/U] :x
17/09/11 17:40 More...
By abdul mannan mollick

Most favoured
Ab Workouts
fvwm2 - Random Wallpaper Print
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

Be first to comment on this article
RSS comments

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • Personal verbal attacks will be deleted.
  • Please don't use comments to plug your web site. Such material will be removed.
  • Just ensure to *Refresh* your browser for a new security code to be displayed prior to clicking on the 'Send' button.
  • Keep in mind that the above process only applies if you simply entered the wrong security code.
Name:
E-mail
Homepage
Title:
BBCode:Web AddressEmail AddressBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
Comment:



Code:* Code
I wish to be contacted by email regarding additional comments

Powered by AkoComment Tweaked Special Edition v.1.4.6
AkoComment © Copyright 2004 by Arthur Konze - www.mamboportal.com
All right reserved

 
< Prev
 
Top! Top!