Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: random backgrounds, can it be done ?< Next Oldest | Next Newest >
libretto Offline





Group: Members
Posts: 336
Joined: Oct. 2003
Posted: Sep. 04 2004,16:36 QUOTE

Hello there,

Looking to get the background wallpapers changed based on picking a random file from a directory. I understand that fluxbox should have the 'fbsetbg' command and passing -R option makes it choose a random pic. You can even add a line to cron to do it automatically.

Basically, is fbsetbg included in fluxbox that comes with DSL, or do I need to get one of the later versions of fluxbox for this to work ???


--------------
Small Radio,  Small Laptop, DSL Linux
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Sep. 04 2004,18:08 QUOTE

fbsetbg is a shell wrapper which contains an extra piece of script to choose a random image from the given directory.  It's not included with DSL, since there is already the bsetbg wrapper and xsri.
You could build a small script to do this with existing applications.  something like:
Code Sample
#!/bin/sh
pic_dir=/home/user/.fluxbox/backgrounds
num_pics=`ls -Al "$pic_dir" | grep ^- | wc -l | tr -d ' '`
bg_pics=`find "$pic_dir/*"`
pic_array=($bg_pics)

bsetbg -f "${pic_array[$((RANDOM%num_pics))]}"


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
libretto Offline





Group: Members
Posts: 336
Joined: Oct. 2003
Posted: Sep. 04 2004,22:41 QUOTE

Ok thanks for the code I will try it later.

[EDIT] Took out the star (*) in the bg_pics line adn the code works!

Cheers, Libretto :cool:


--------------
Small Radio,  Small Laptop, DSL Linux
Back to top
Profile PM WEB 
2 replies since Sep. 04 2004,16:36 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: random backgrounds

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code