Work

Yweather Puts The Weather On Your OS X Desktop

Mac OS X only: Reader Daniel used his ubergeeky perl skills combined with GeekTool and created a more powerful way to display the current weather conditions on his desktop.

Daniel’s script extracts the current weather information from Yahoo’s feeds, caches it locally, and allows you to use each piece of data separately—it even grabs the current weather image and caches it locally so you can include it on your desktop.

Daniel explained how his script works, and how he includes the information on his desktop:

I wrote a perl script that pulls the xml from the rss feed and caches it locally and extracts the information from the local version. A parameter is included to update the local cache. In addition it also pulls the images from the main yahoo weather page that represents the weather, not the ones in the rss feed and caches them locally.

The scripts I use to display my weather in geektool are as follows, for the forecast I use 4 scripts:

echo `yweather -fd1` ” – ” `yweather -ft1`
echo “H: ” `yweather -fh1` ” L: ” `yweather -fl1`
echo `yweather -fd2` ” – ” `yweather -ft2`
echo “H: ” `yweather -fh2` ” L: ” `yweather -fl2`

The current temperature and description:

yweather -ct
yweather -cw

And I have the update command set to run every 30 minutes:

yweather –update && yweather –copyimage

You can grab the script for yourself at the link below, or check out how to put news on your desktop with GeekTool. Great work, Daniel!

Yweather perl script [Pastie]

Comments (AU Comments | US Comments)

  • Thom

    When I try to run the script in terminal I get the following error: ‘Global symbol “$iconfile” requires explicit package name at yweather.pl line 164.’ Anybody have an idea what I’m doing wrong?

    Also, as a newbie to perl, I would greatly appreciate it if some kind soul would take the time to post a detailed walkthrough.

    Thanks.

Post Your Comments

Got something to say? There are two ways to comment:

1. Guests

Click here to comment instantly.

2. Facebook Users

Click below to comment using your Facebook account.

We're looking for comments that are interesting, substantial or highly amusing. If your comments are excessively self-promotional, obnoxious, or even worse, boring, you will be banned from commenting. All comments are moderated.