Traditionally, I’ve never had the same wallpaper on any computer for more than a half hour at a time. I like my wallpapers to rotate, since I’m surrounded by 3-4 computers at any given time and usually only working on 1 or 2 of them. This way I can have nice pictures flying by to keep my perhipheral vision entertained and people walking past my window can marvel at the 3D art I have displayed.
Note: This will work on any system using gnome, or just about any other system if you know your way around cron. I happen to run Ubuntu though, and enjoy it over other distros, so that’s where I wrote this and that’s how I titled it.
I also like to see what’s going on with the world, particularly the weather but often find myself not in orbit so I’m unable to track worldwide weather patterns like I want to.
Then a though occurred to me - what if I set up one of my Ubuntu boxes to have a map of the world with clouds overlayed, updated every hour? Neat! I now have a map of the world with cloud overlays updated hourly for my background.
It took me a little time to figure this out but I’ve nailed it and now you can do it too by following my quick, easy plan to wealth and . . . er. . . to a weatherified desktop.
First, you’re going to want to get a program called gnome-schedule. You can either start Synaptic (System-> Administration-> Synaptic Package Manager) and search for ‘gnome-schedule’ or open up a terminal session (Applications-> Accessories-> Terminal Session) and type:
sudo apt-get install gnome-schedule
What is it? Gnome Schedule is a GUI front end to Cron, which is a scheduling daemon. It allows you to tell your computer to execute a command at a given time, which in our case is going to be every hour - and to repeat this command at given times, again, hourly.
Gnome-scheduler isn’t automagically added to your menus, so let’s add it to the Applications-> Accessories menu, shall we? Right click on Applications and choose “Edit Menus”. From there, left click on Accessories and click the New Item button. Call this new menu item “Gnome Schedule” in the Name field and in the Command field, type ‘gnome-schedule‘.
Click okay, and it’s there. You can also always launch it from a terminal session by typing gnome-schedule.
Thankfully, there’s an awesome site out there called die.net. They host a nice good sized image of the world with cloud cover updated once every hour or so. We’re going to automate the task of going to die.net and downloading the needed .jpg file.
Open Gnome Scheduler, and click the New button. From there, choose “A task that launches recurrently”.
In the description field, call it “weather wallpaper” or whatever you’d like. In the Command field, type
wget -r -N http://static.die.net/earth/mercator/1600.jpg
In the Time & Date section, click the Advanced radio button. Now, in the Minute field, put something between ‘10‘ and ‘55‘ - you choose a number. In the hour field, put 0-23. Now click the Add button to add this task to your scheduler.
What does this do? It tells your computer to go out to die.net and grab the 1600.jpg file some number of minutes past every hour. Why do it this way? Well I figure if the image updates on the hour and my clock is a little off, a few minutes past the hour or a few minutes to the hour should be enough leeway for me to get the latest image. If we vary our numbers, we won’t all flood the site at 10 minutes past.
Once you’ve added this to Gnome Schedule, click the Run task button. This will execute the task so you can both test it, and grab the appropriate file. Gnome Schedule will run this command as you, and dump the file into your home directory.
Now to get it on to your computer as your background. Right click your desktop and choose “Change Desktop Background”. Now click the Add button and browse to your home directory. Choose the file 1600.jpg and it will be added to your backgrounds and set up as your wallpaper.
When this image updates every hour, your background will automatically update as well. Neat, eh?
You can do this with any image that’s available on the web which updates. All you need is the URL to download the image and you’ll have to modify your little script to reflect the correct file name.
Enjoy!
EDIT: Thanks to Sam R and some astute Reddit readers, I’ve edited this article to make it even easier to do. Now - anyone got a list of pictures online that are updated every N minutes?
Technorati Tags: ubuntu, how to, wallpaper, desktop, rotating, weather map, linux, updated world cloud coverage, geek


















August 20th, 2008 at 1:26 pm
Ben - Very nicely done tutorial.
I am really enjoying your linux tut’s. Keep them coming.
August 20th, 2008 at 1:46 pm
Thanks Andrew - I’m enjoying figuring out new stuff to do with my linux herd.
August 20th, 2008 at 7:20 pm
Hi, thanks for this. However… it doesnt work for me. I’m running Compiz with the Desktop Cube. It is set to use multiple backgrounds, by turning off Nautilus Show Desktop, and doesn’t seem to watch for changed picture files. Everything else works.
Do you have any idea how to get this working with the Desktop Cube?
thanks
dave k
August 20th, 2008 at 7:21 pm
Nice tutorial.
One suggestion would be to rewrite your script from:
rm 1600.jpg
wget http://static.die.net/earth/mercator/1600.jpg
to:
if wget http://static.die.net/earth/mercator/1600.jpg -O new.jpg
then
mv new.jpg 1600.jpg
else
rm -f new.jpg
fi
This way, if your computer can’t download the image, the previous version of the file will be preserved.
August 20th, 2008 at 8:15 pm
Groovy idea.
I’m a bit of an organization freak and throwing scripts into my home directory drives me nuts. Isn’t /usr/local/bin the appropriate place? This of course would require a change to the script as it does not use absolute paths.
I see that we are under the assumption that we are online every hour. For anyone working offline, e.g. laptop users, this could mean no background until you get back online
Cheers,
Sam
August 20th, 2008 at 8:43 pm
Instead of creating wp.sh, the command I run from the scheduler is
cd /path/to/wp/dir/ ; wget -N http://static.die.net/earth/mercator/1600.jpg
This way you won’t lose your wallpaper if you are not online.
Cheers,
Sam
August 20th, 2008 at 9:35 pm
Hi Folks,
Thanks for the great suggestions. As for the compiz bit - I’m not sure about that one. I haven’t run compiz for a while but if I get the chance, I’ll fire it up and see what I can do with it.
Ben
August 23rd, 2008 at 2:18 am
Does this update when the image changes though?
A better thing to do would be when you download the new wallpaper, to refresh the gconf entry so that nautilus reloads the new version of it.
(Oh and you got this from Lifehacker didn’t you :-] )
August 23rd, 2008 at 12:35 pm
Hey Sam R, I think the most appropriate place for a single user’s script like that would be in ~/bin. Ubuntu doesn’t create that folder for new users probably just to avoid being confusing, but if you make it yourself every executable script you put inside will automatically be included in your PATH, eg:
$ ls ~/bin # my script is in ~/bin
sayhello
$ ~/bin/sayhello # an absolute path would work for any script
Hello there!
$ sayhello # but this works like a normal command would
Hello there!
August 23rd, 2008 at 5:06 pm
Wow, thats cool! thanks for sharing!
August 25th, 2008 at 5:52 am
@R Samuel Klatchko
I prefer your suggestion, that way my desktop wallpaper doesn’t display half-downloaded if my connection lags.
I also decided the images were worth keeping, so I copy the new ones to an incrementing filename.
ie.
#!/bin/bash
cd /home/cnawan/bin/
if wget http://static.die.net/earth/mercator/1600.jpg -O new.jpg
then
mv new.jpg current.jpg
cp current.jpg ` date|awk ‘OFS=”.”{print $2,$3,$6,$4}’`.jpg
else
rm -f new.jpg
fi
which yields files like: Aug.25.2008.21:43:30.jpg
September 9th, 2008 at 3:35 pm
great job man, I like your tutorials
September 24th, 2008 at 1:48 am
Is there an easy way to add to the command so that it will rescale to, say 1280×800 before it saves?
September 24th, 2008 at 1:50 am
With the post right above this, I am referring to the gnome scheduler method.
September 24th, 2008 at 2:24 am
@Bobby
The extra step would have to be performed by another command, so you’d need to call a script from gnome scheduler that includes the wget line and then a command to resize the image.
Check out ImageMagick’s convert command. Package “imagemagick” in the repositories. Examples at http://www.imagemagick.org/script/convert.php.
September 24th, 2008 at 4:08 pm
ok, I tried aendruk suggestion
so get imagemagick
#sudo apt-get install imagemagick
then add this to the scheduler
wget -N http://static.die.net/earth/mercator/1600.jpg ; convert -resize x800 1600.jpg wallpaper.jpg ; rm 1600.jpg
and add wallpaper.jpg as your wallpaper
this method does not produce image exactly 1280×800, but height is 800 so it covers whole screen
February 24th, 2009 at 12:20 pm
thanks clever_fox that’s what I was looking for
March 3rd, 2009 at 2:47 pm
i do the same but with xplanet so i don’t need to download nothing ( apart clouds if you want them in real time! )
April 11th, 2009 at 12:28 am
Thant’s helpful. Thanks!
April 11th, 2009 at 12:29 am
That’s helpful. Thanks.