Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Change desktop picture in Gnome periodically
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
mridle
n00b
n00b


Joined: 09 Mar 2005
Posts: 8
Location: denmark

PostPosted: Fri May 19, 2006 11:49 am    Post subject: Change desktop picture in Gnome periodically Reply with quote

Hi all

I have a little idea, that I would like to implement, but I'm a little unsure of what and how to do it - so I hope that you experts have a good solution...

What I would like to do is to change my desktop picture ("the background") in Gnome periodically, say every second hour or so. The background picture should be taken from this site http://www.dmi.dk/dmi/index/danmark/radar.htm. The picture I'm interested in, is the center big one. This picture does not have a static name though - it changes name with every update.

As I see it, there are two parts to this problem.
1) Get a cron job to get the picture with the everchanging url
2) Get Gnome to change the background picture.

I hope, that you're able to help me out there...

Thanks in advance for any suggestions!

/Andreas
_________________
connection reset by beer
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Fri May 19, 2006 4:30 pm    Post subject: Reply with quote

Taking a quick look at the page source, the important line seems to be:
Code:
  <td width="448" valign="top" class="broedtekst"><p><font class="rubrik">Radar</font></p><p><img src="605191400_4533" width="444" height="333" border="0"></p><p><a href="index/danmark/radar/radar_3.htm"><img src="arrow_forrige.gif" width="21" height="21" alt="Forrige" border="0" width="21" height="21"></a></p>
The URL for the current image is "http://www.dmi.dk/dmi/605191400_4533". So you could use wget to download the page, use perl or gawk or sed to extract the image file name from the above line, then use wget to get the image file ("http://www.dmi.dk/dmi/<current filename>") and save it (with a .jpg extension).

For part 2, take a look at gconftool-2. It's a command line tool that can, among other things, change a key in gconf, which is where the Gnome settings are. I'm not at my home machine so I can't test this out, but you should be able to change the name of the desktop background to the image file you saved in step one and gconfd would change it right away.

You'll need to do a little research on the above commands to get this to work, but this approach should do it. :)

In fact, now that you've given me the idea I may try this out myself when I get home tonight -- though maybe with something other than Danish weather radar. :wink:
Back to top
View user's profile Send private message
mridle
n00b
n00b


Joined: 09 Mar 2005
Posts: 8
Location: denmark

PostPosted: Mon May 22, 2006 6:06 am    Post subject: Reply with quote

Thanks for your help - greatly appreciated. Part of my problem is, that regular expressions and the like are not my strongest side, so extracting just the img src (which change every hour or so) is beyond my capabilities... :oops: Any help on this would be great

Great hint about gconftool - I'll look into it when I get home from work.

/Andreas
_________________
connection reset by beer
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum