which version are you using as there have been a few modifications in this thread
which version are you using as there have been a few modifications in this thread
ubuntu version 8.10, first version of coding(post 1) - nt sure on what u mean by which version
ok there are other few modifications of the scripts in later posts, including one by me.
my problem seems to be with the timer as it changes on reboot an i can change it manually
I just switched back to Gnome from XFCE, and found myself sorely missing the random wallpapers function on a timer that displays a unique wallpaper on each monitor. So I wrote a perl script to do it for me. I have posted it at http://lotech.org/code/random_wallpaper.pl.html if you're interested.
Here's a script that can search recursively through sub-folders ...
... but perhaps someone can tell me why it has problems with spaces in filenames?Code:#!/bin/bash folder="pictures" cd $HOME/$folder files=(`find * | grep -i "\.jpg$\|\.gif$\|\.png$\|\.bmp$"`) # Get the size of the array n=${#files[@]} # Prevent a blank screen if there are no pictures if [ $n -eq 0 ]; then exit 1; fi # Set a random wallpaper with gconftool-2 gconftool-2 -t str --set /desktop/gnome/background/picture_filename "$HOME/$folder/${files[RANDOM%n]}" exit 0
"Knowledge is power. Who said that?" - Dave Lister
Ok. I solved the problem with spaces in the filename.
2 lines of code! I added "tr ' ' '¿'" to change spaces to another character (¿), which is very unlikely to be found in a filename. It then gets changed back to a space when setting the background.Code:#!/bin/bash files=(`find $HOME/pictures | grep -i "\.jpg$\|\.gif$\|\.png$\|\.bmp$" | tr ' ' '¿'`) # Set a random wallpaper with gconftool-2 gconftool-2 -t str --set /desktop/gnome/background/picture_filename "`echo ${files[RANDOM%${#files[@]}]} | tr '¿' ' '`" exit 0
"Knowledge is power. Who said that?" - Dave Lister
Dude,there is something wrong with my pc cant get through with the administrator!i think i am being hacked cos when i pay my monthly bill other name appear on list and it was not my computer's name.when I log in to my pc there are two user's and i cannot log in to my account cos it needs a password.they say reformat is the best solution so I try but it's still there!now I am using other account without password and the name of the account is KAMANDAG...anyone,please help me!i try the how to but it wont work,it say that is not recognized as an internal or external command,operable program or batch file...I am suffering this situation for already two Fu***&&& months...please help! tnxz...you guys rock
wow... pretty impresive! man... i wanna get unbuntu just for this kind of stuff!
Niicodemus -
This perl script looks to be exactly what I am looking for. I have dual monitors and would like a different wallpaper on each monitor. I downloaded your script and gave it a try but have some syntax errors.
I edited two of the Options section as follows:
Code:my @screens = ( ['1280', '1024'], # Left monitor ['1280', '1024'], # Right monitor );When I run the script I get this:Code:my @wallpaper_dirs = ( '/home/twoblues/Pictures', );
Since I know about as much about perl as I do about quantum mechanics, I could sure use your help.Code:twoblues@Stealth:~/Documents$ ./random_wallpaper.pl syntax error at ./random_wallpaper.pl line 142, near ">" syntax error at ./random_wallpaper.pl line 142, near "<" syntax error at ./random_wallpaper.pl line 142, near "<" syntax error at ./random_wallpaper.pl line 142, near "$tile_height) " syntax error at ./random_wallpaper.pl line 146, near "}" syntax error at ./random_wallpaper.pl line 156, near "];" syntax error at ./random_wallpaper.pl line 161, near ">" syntax error at ./random_wallpaper.pl line 161, near ""${columns}x${rows}")" BEGIN not safe after errors--compilation aborted at ./random_wallpaper.pl line 172.
TIA,
xeddog
Edit: almost forgot. I don't know if this matters or not, but yesterday I upgraded my Intrepid installation to Jaunty using the upgrade process. I did not try this on Intrepid. I am using Intel 32-bit with an ATI Radeon 9600 graphics card which means that I am having to use the opensource drivers since the ^%$#@ at AMD are dropping support for it.
Last edited by xeddog; April 24th, 2009 at 08:01 PM. Reason: Additional info
Bookmarks