Forecast.io Weather on the Mac DesktopBecause I could.
When I saw that the excellent weather service forecast.io released a feature called Forecast Embeds, I thought it would be neat to show the widget directly on my Mac’s desktop. I whipped up a solution that ended up looking like this:
Read on to learn how get Forecast Embeds up and running on your Mac’s desktop.
- GeekTool, NerdTool, or any other tool that can display an image directly on the desktop
- The following command-line utilities, all of which are available via Homebrew on OS X:
forecast_snapshot.sh, a simple shell script I wrote
How it Works
- On a reasonably slow interval, the
forecast_snapshot.shscript automatically takes a screenshot of the Forecast Embeds page with the latest weather data, and stores that screenshot on the filesystem. It then does some image processing on the screenshot to make it look more attractive when overlaid onto a wallpaper.
- On a reasonably fast interval, the screenshot is automatically [re-]displayed on the desktop.
Getting it Going
Install the dependencies listed above, and grab a copy of the
Edit the variables in
forecast_snapshot.shto your liking.
You’ll need to provide the latitude/longitude for your area, which you can find using a service like latlong.net. There are several available options that aren’t part of the script, but can be added to the Forecast Embeds URL in the script. See the Forecast Embeds documentation for details.
forecast_snapshot.shand verify that the image file
/tmp/weather-full.pngis created on your system, and contains the font/text/weather information you expect.
/tmp/weather-full.pngimage on your desktop using GeekTool (or your tool of choice.) I configured GeekTool to refresh the image every minute.
forecast_snapshot.shautomatically run on an interval (15 minutes seems reasonable). You can do this via GeekTool or
Forecast Embeds are simple web pages that include animations, so the sceenshots that are taken will inevitably catch the animations mid-frame. If you prefer to keep the animations working, you can use something like Fluid to float the Forecast Embeds page on your desktop as its own app, but it won’t be transparent and thus won’t blend in with your wallpaper.