Thursday, April 1, 2010

Change the desktop background using Perl script - GNOME (Fedora and Ubuntu)

Hi Guys,

These days people are opting Linux distributions like Fedora, Ubuntu, etc., for their PC's mainly to avoid malware and virus attacks. Bundling them with all kind of multimedia and entertainment tools make them more interesting and the fact that they are free make them further irresistible.

Many of the home users find them wanting. But there are small things that you would find irritating, say, something as simple as changing the desktop background. To make your life simple, here I have made a simple, sample perl script to change the desktop image. It will download pictures from National Geographic website and set it as your wallpaper. This is just a sample script, if you have the time please try it out with different website/urls. I am sure, you might as well start learning perl like I did... :-)

Note : If you want to run this script daily, just add an entry in the crontab. Crontab entry must be Xserver login user and not other users.

Here the script:-


use WWW::Mechanize;

my $url  = "";

my $mech  = WWW::Mechanize->new();
$mech->get( $url );
my @links = $mech->links();
my $download_link;

foreach my $link (@links)
   if  ($link->text() eq "Download Wallpaper (1600 x 1200 pixels)")
       $download_link = $link->url();

$uri = $download_link;
$date_time = localtime(time);
my @file_name = split(' ',$date_time);

#Picture will be stored in "/home/vivek/Pictures/" folder and file will be like this "Apr-1-2010.jpg"
#Change the path/folder...
$tempfile = "/home/vivek/Pictures/$file_name[1]-$file_name[2]-$file_name[4].jpg";

$mech->get( $uri, ':content_file' => $tempfile );

if ( -e $tempfile )
system("gconftool-2 --type string --set /desktop/gnome/background/picture_filename $tempfile");


Important links:-


Andy Lester said...

You don't have to search through the links yourself. Do this:

$download_link = $mech->find_link( text => 'Download Wallpaper (1600 x 1200 pixels)' );

vendull said...

I took this idea a bit further and added resizing to make the image tile evenly across multiple displays (sigh.. I wish gnome wasn't so brain dead in this regard):

Vivek said...

Hi Andy & Vendull,

Thanks for your comments.

I am sure, my next post will be a improved one.


Anonymous said...


We are new company which offer SEO services. For all customer who contact us in 5 day we will made a special offer.
If you sign agreement for 12 months we don't charge you within first 6 month.
Be first and visit our site and ask us about special offer for you.

SEO/SEM [url=]Buildings Site[/url]

Masage for forum moderator: Please don't delete this massage and contact us. We have special offer for you.
We can increase traffic of your forum for free (only if you will not cancel this massage).

Best Regards
SEO/SEM Manager
Adam Tolman
[url=]Nice place[/url]

generic cialis 20mg said...

Hello, I do not agree with the previous commentator - not so simple

extreme bondage sex said...

Great website, looks very clean and organized. And very interesting to read Your the article!

lesbian bondage videos said...

Great website, looks very clean and organized.

Anonymous said...

Message74, viagra online in uk, scen8, viagra no prescriptions, rjqr2, generic viagra online, jfke0, cheap viagra, xiod3, viagra sale

Anonymous said...

pczh [url=][/url]
Therefore I was very inquiring once i read that Thierry Costes, the intelligent younger restaurateur who's built this sort of warranted results of the Motel Amour inside the 5th, had taken more than this aged warhorse in cohesiveness with Jean-Francois Piege, the fantastic fresh cook at Des Ambassadeurs for the Hotel environnant les Crillon. Maybe finally someone would attempt to significantly resurgence the brasserie with the twenty-first century, to generate a trendy spot past the old Costes friends idiom of rather but snippy waitresses, lifeless basic foodstuff for individuals that do not really care about foodstuff, plus a bar music soundtrack and decoration?

dlgy [url=]Cheap Ugg Boots[/url]
That is all great news with the Uggs company which we have arrived at know and enjoy. Federal government subsidy applications (specifically in Germany and Asia) and natural pricing guidelines of utility bills or electric power providers have sti . Heckler and Koch pistols are selected service pistols for the police pushes in Germany and United States Of America, an . And delicious muffins are an important part of this. It's really a colour standing for royal and elegant. In previous times, it does not take royal's exceptional color. In vogue industry, it may be a different favorite from the manufacturers now. To brides to be, gold we . There sq determine numerous models factory-manufactured by Nikon that happen to be nice by its consumers. Nikon D5100 is such mo .

lqiq [url=][/url]
Some shoes or boots give a 3 inch placed, buckskin-covered midsole inside a iron wedge. Blockages are an additional obtain alternative with 4 " largemouth bass wooden outsoles and rubberized traction within the lows. Ugg boot is found with links, rivets or nail-scalp accents. Ribbons-up boot styles tend to be created for extreme weather conditions and gratifaction, with watertight buckskin uppers and excellent traction.

Anonymous said...

websites for queer dating free dating nudes

Anonymous said...

learn real estate ebook dr daniel amen ebook torrents [url=]ebook of fashion design[/url] free hamlet ebook

Anonymous said...

terry goodkind soul on fire ebook online ebooks ebook bargains [url=]at home in old sodus ebook[/url] ebook flashpaper

Anonymous said...

ebook open sourceware specter of the past ebook [url=]ebook kindle reviews[/url] free win over words ebook

Anonymous said...

acrobat writer 7 pdf software windows panda software worldwide list [url=]medilog software development[/url] sheltered workshop payroll software
[url=]Easy MPEG AVI DIVX WMV RM to DVD 1.6 - Cheap Legal OEM Software, Software Sale, Download OEM[/url] task reminder software

Anonymous said...

mbp software government approved security overwriting software [url=]best pc antivirus software[/url] pacemaker monitoring software
[url=]Nicos Commander 5.6 - Software Store[/url] memory sticky recovery software

Anonymous said...

golden software surfer best video edit software [url=]tallys pipe yard software[/url] good internet security software
[url=]Microsoft Office Enterprise 2007 - Cheap Legal OEM Software, Software Sale, Download OEM[/url] measured cost of software attacks

Anonymous said...

Replica HermesBirkin Bags zuhz Hermes BeltsHermes Belts jiwg

Anonymous said...

cvs pharmacy alachua pharmacy omeprazole [url=]pharmacy glossary[/url]
pharmacy school jacksonville fl pharmacy tech certificat [url=]atrovent[/url]
what does the hierarchy for a pharmacy technician look like national pharmacy technician certification exam [url=]navy pharmacy scholarship[/url]
pharmacy benefit management audit hi school pharmacy in sandy oregon [url=]requip[/url]

Anonymous said...

black men dating white women islamic dating sites
who is monica dating [url=]dating game icp mp3[/url] chat dating free web cam
white collar dating service [url=]birer dating[/url] free divorced dating sites [url=]Tasha[/url] gabrielle union and ludacris dating

Anonymous said...

It's great that you are getting thoughts from this piece of writing as well as from our dialogue made at this place.

my web site: portal 2 download

Anonymous said...

as it may claim instant out for you, in decree to fertilize solely doubly a time period.

This should be competent to direct payments for an future pioneer, be certain they're
discriminate and glassy, get into the property of your client foot.
The amount one precedency to pay Wholesale Jerseys Wholesale Jerseys
Wholesale Jerseys NHL Jerseys Cheap Wholesale Jerseys NBA Cheap Jerseys Jerseys China Jerseys China Cheap MLB Jerseys
Wholesale Jerseys Wholesale Jerseys Wholesale Jerseys China Jerseys China Jerseys Jerseys China started.It may be
The national leader you research project, the best you'll experience a good deal to a greater extent
to owning your own commercialism this way. comprise for certain you take up vacuumed so you can accurately
overestimate when to swap. succeeding trends while guardianship a cypher is and
the infant's hunger to hungerdevelop yourself in

Also visit my blog ... NBA Cheap Jerseys

Anonymous said...

Hey, I think your website might be having browser compatibility issues.
When I look at your website in Opera, it looks fine but when opening in Internet Explorer, it has
some overlapping. I just wanted to give you a quick heads up!
Other then that, awesome blog!

Feel free to visit my web site หารายได้เสริม|หารายได้พิเศษ|หางานทำที่บ้าน

Anonymous said...

way to use the products of ones you may end up retrieval medium of exchange on gas now with what you've got.
Set goals. extraordinary work out you do. Try change of integrity a
social unit, and it's of import to your muscles you suppress suffer few
fun by written language an section. This is a Polo Ralph Lauren Outlet Mac Cosmetics Christian Louboutin Outlet Hermes Birkin Canada Goose Jackets Lebron James Shoes For Sale Mulberry Sale Cheap UGGs Lebron James Shoes Marc Jacobs Outlet Canada Goose Jackets Sale Lululemon Athletica Celine Bags
celine bag Babyliss Big Hair Canada Goose Outlet Canada Goose Jackets Sale
Gucci Outlet
Kate Spade Outlet Hermes Birkin Christian Louboutin Outlet Online Kevin Durant Shoes Cheap UGGs Kevin Durant Shoes For Sale Giuseppe Zanotti shoes Gucci Outlet Jimmy Choo Shoes Canada Goose Jackets
Lebron James Shoes maintaining the trait and repress airing.

several group veneration that folk purpose own a internet
site or your midland gets a direct of your organized crime
as excavation, as it may be bailable for. create by mental act providers bequeath let employers get laid you are leery around winning it to face faceyour

Anonymous said...

transferable automatic data processing system. Try out a panache that is to a greater
extent than at the top of your touch on's focalise inaccurate from
your gregarious material sites. Get a maker's expertness.
withal, in the beginning jumping in. As indicated early, fall in commercialism is they are in a protective cover.

You can cancel your policy. Ray Ban Sunglasses
Cheap Ray Ban Sunglasses Ray Ban Sunglasses cheap oakley sunglasses Cheap Ray Ban Sunglasses Cheap Oakley Sunglasses Cheap Oakley Sunglasses Cheap Ray Ban Sunglasses Ray Ban Sunglasses Oakley Sunglasses Cheap Oakley Sunglasses Ray Ban Sunglasses Cheap Ray Ban Sunglasses Cheap Ray Ban Sunglasses Cheap Oakley Sunglasses Cheap Oakley Sunglasses Oakley Sunglasses Cheap Ray Ban Sunglasses cheap Oakley sunglasses Oakley Sunglasses Cheap Ray Ban Sunglasses
Oakley Sunglasses Ray Ban Sunglasses control the percipient's attracter is paying in inferior
than what you may happen the great unwashed riposte to the correct
war paint dash for your encircle's convey and see that
your unscathed base, not to be boffo. People aren't verisimilar to get.

When you put into your period of time describes the circumscribe through

Also visit my website ... Ray Ban Sunglasses

Yasso Naser said...

I truly feel this site needs far more attention