Productivity

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]


Have you subscribed to Lifehacker Australia's email newsletter? You can also follow us on Facebook, Twitter and YouTube.