GeekTool Revisited: Weather Conditions – Part Deux

August 5, 2009 in How-To, Tips & Tricks by Bob Faulhaber

In previous posts we described how to put the current date and time on your desktop, along with the ability to display images, in our example we used a doppler radar image, but what if you want actual weather conditions? Using GeekTool and a Perl script, called yweather, developed by a Google Code user named loudambiance, you can pull weather data from the Yahoo feed and display on your desktop.

In our example, we will describe how to display the current temperature and conditions for our area as shown below.

20090804_voila_capture7

To begin, you need to download yweather.pl from the Google Code site.

1. To download, goto http://code.google.com/p/yweather/

2. Copy yweather.pl to a sub directory named bin under your directory. - /Users/<username>/bin

3. Using Terminal make the script executable using the following command:

chmod +x yweather.pl

4. While still in the same directory as the yweather.pl script, create a subdirectory call yweather-dir using the command:

mkdir yweather-dir

5. Exit Terminal

6. Using Finder, navigate to the /Users/<username>/bin directory and open yweather.pl using TextEdit.

20090804_voila_capture8

7. Make the changes under the Variable section in the file to reflect your location and the directory location of yweather.pl

8. Save the changes and exit TextEdit

9. Open the GeekTool Preference Pane found under System Preferences

20090804_voila_capture9

10. Create four Shell entries to display the appropriate data.

Temperature:    /Users/<username>/bin/yweather.pl -ct

Units:  /Users/<username>/bin/yweather.pl -ut

Conditions:   /Users/<username>/bin/yweather.pl -cw

Since yweather fetches the weather data from Yahoo and caches it locally, we need a command that will occasionally  fetch the latest data from Yahoo. Create the following command to fetch the information:

/Users/<username> /bin/yweather.pl -update

11. Using the GeekTool configuration options, you can adjust font size, color, location on the desktop along with the desired refresh time.

There are many other weather information items that can be displayed and a complete listing can be found in the yweather.pl script.