Growl and GeekTool

To reduce distractions, I’ve been on a clean Desktop kick for the past few weeks. I’m being more vigilant about moving my downloads into the proper folder (which is usually the Trash), and I’ve gotten rid of the clutter of GeekTool, despite the several little scripts I’ve written to take advantage of it. Now my Desktop is an almost pristine expanse of dark blue.

Of course, some of the things GeekTool did for me are still pretty important. I like to know whether last night’s SuperDuper! backup worked. I often want to see what the weather is like. So I’ve installed Growl and set it up to tell me these things.

Now, you may be thinking that “Growl” and “reduce distractions” have no business in the same blog entry. And up until recently I’d have agreed with you. I’ve installed Growl several times in the past few years, only to grow disgusted with its nattering and delete it within a day or two. But if you disable Growl for almost every application, and use it only when you really want a notification, it can be a great tool.

For example, I have it set to put up a notification when a scheduled SuperDuper! backup is finished. These backups occur overnight, so I’m never at the computer working when the Growl note pops up onto the screen. But because I’ve configured the SuperDuper! notices to stay onscreen indefinitely, the note is there waiting for me to read and dismiss it when I sit down at my computer the next morning. To be sure, Growl’s SuperDuper! notice isn’t as detailed as the one I wrote for GeekTool, but it gets the job done, and it disappears when I no longer need it.

To get the current weather, I use FastScripts to trigger a Growl notice via the growlnotify command-line tool. I start with a shell script, called growlweather:

#!/bin/sh

$HOME/bin/weathertext | /usr/local/bin/growlnotify -t Weather -n growlweather

As you can see, it calls my weathertext script, which is described here and can be downloaded from this GitHub repository. The output of weathertext is piped to growlnotify and given the title (-t) “Weather” and the name (-n) growlweather. I have Growl configured to display notices from growlweather in a nice HUD-style display in the lower right corner of my screen.

This style doesn’t come with Growl; it’s a WebKit-based display plugin that I adapted (by making a few simple CSS changes) from Ingmar Stein’s Example plugin. I’ve put it in its own GitHub repository. From the repository’s README:

This is the template I start with for WebKit-based Growl display plugins. It uses white text on a black background and a largish font for easy reading. The icon is not displayed, but this can be easily changed with commenting/uncommenting in the default.css file.

One of the weird things about Growl is that the display options are unchangeable within a style. You cannot, for example, use Smoke with a 2-second duration for one application and Smoke with a 5-second duration for another—you have to have two differently-named copies of Smoke, one for the 2-second display and one for the 5-second display. The purpose of this template is to allow me to make a new style quickly when I need one for trivial changes like that.

The style is based on the WebKit plugin Example by Ingmar Stein. The documentation for WebKit plugins is here. Before you install it, you’ll want to change at least

  • its name
  • its CFBundleName
  • its CFBundleIdentifier
  • The latter two are in items in the Info.plist file.

You may be wondering why I didn’t just use FastScript’s display message AppleScript command, described nicely by John Gruber in this Daring Fireball post and used by me in my tea timer script. In fact, that’s what I tried first. Unfortunately, FastScripts’ display message window won’t grow to the size I need.

Growl’s extensibility via HTML and CSS made it the winner.