NerdTool, PICTs, and Buddhism

I used to be GeekTool user but abandoned it about a year ago when I decided I wanted a pristine Desktop. In the intervening year, I’ve learned that a pristine Desktop is easier to want than it is to keep. Oddly enough, it seems that the best way to keep files from piling up on my Desktop is to have something else there I want to see; that gives me the incentive to clean out the files more often.

A couple of weeks ago, Brett Terpstra showed his Desktop, a very pretty thing. He uses NerdTool, a fork of GeekTool that seems works in basically the same way. I figured if a smart guy like Brett chose NerdTool, it’s worth a look. So I downloaded it, started it up, and then began rummaging around for the scripts I used to use with GeekTool. Here’s the result on the 24″ iMac in my office:

Desktop with NerdTool

It’s not much. The time and date are in the lower left corner, using these one-liner shell scripts:

date "+%l:%M %p"

for the time, and

date "+%A%n%b %d"

for the date. The %l specification for the time puts a space character before single-digit hours (check the strftime man page), something I normally don’t like, but in this case it’s at the beginning of a right-justified string, so the extra space doesn’t get in the way.

The upper left corner shows the output of my SuperDuper! status monitor, a Perl script called dupersummary. I have SuperDuper! do a bootable backup every night, and the purpose of this script is to summarize the rather long log file to let me know whether the backup was a success.

Under the SuperDuper! summary is the weather, generated by my weathertext script.

The lower right corner shows the current track playing in iTunes and its album cover art.

All of these are scripts I used to use with GeekTool, and they were all easy to find, either on my hard disk or in an old post here. So getting NerdTool up and running was pretty painless. There was one problem, though.

When iTunes isn’t playing, the space normally taken by the album cover art is supposed to be filled with a square that matches the color of my Desktop background. (This is discussed in detail in the post with the album art scripts.) I had a ready-made PICT file to serve that purpose, but it didn’t work anymore because I’d changed my Desktop color to a darker blue. The old PICT didn’t match.

Making a dark blue image file that matched the current color of my Desktop was no problem, but converting it to PICT format was.1 I don’t have a program that can save a file as a PICT.

But AppleScript—specifically the Image Events application accessed via AppleScript—can convert to PICT. So I made a PNG file of the correct color and saved it as “albumArt.png” on my Desktop. Then I wrote and ran this little AppleScript,

1:  set thePNG to ((path to home folder) as text) & "Desktop:albumArt.png" as alias
2:  set thePICT to ((path to home folder) as text) & "Desktop:albumArt.pict"
4:  tell application "Finder" to set creator type of thePNG to "????"
5:  tell application "Image Events"
6:    set theImage to open thePNG
7:    save theImage as PICT in thePICT
8:  end tell

which gave me the PICT I needed.

For a moment, I thought about generalizing this script, making it able to open and convert any image file whose name is given on the command line. But dealing with command line arguments in AppleScript isn’t something I do on a regular basis. It would take a little digging, and some trial and error, to get the syntax right, and it just wasn’t worth it. How often am I going to run this script?

So I’ve left you with a script that served me well but may not serve you well. At best, it’s a foundation on which you can build, not a house you can move right into. Most of the scripts I present here are that way: they work for me, and they can be made to work for you, but you’ll have to muck around in the guts to customize them for your situation. I do it this way not just because I’m lazy, but because I don’t think I can write scripts that work perfectly for you. Only you can do that.

As you might guess from the screenshot, I set up NerdTool on Thursday. That night I started listening to Tuesday’s episode of Merlin Mann and Dan Benjamin’s Back to Work podcast. They were talking about “tips and tricks,” and about 20 minutes in Dan said:

What I realized after that show…is: What you’re talking about is something for people to think about, and it’s almost not possible for you to give them specifics. Or even if it is possible, you don’t want to give them specifics…because giving them specifics is something that they then will…try to apply in a situation that doesn’t actually work. And you’re actually following the Buddha’s own advice, which is that everybody is going to have their own unique problems and there is no one answer, but there is an approach you can take.

That immediately struck me as the best description of what I’m trying to do here in the posts about scripting and productivity. Computers are infinitely malleable and you should mold yours to fit your needs. Just as you get ideas from seeing other people’s customized Desktops, you should take the scripts you see here—and on Brett’s site and MacSparky and Mac OS X Hints and so on—and turn them into something that works uniquely for you.

And then post what you’ve done. There is no one answer, but there is an approach you can take, and we’d all benefit from seeing your approach. The Buddha would approve.

  1. For you youngsters, PICT was the Mac’s native image format back in the pre-OS X days. It was based on QuickDraw, the early Mac’s system-level drawing library. In the old days, every Mac graphics program could read and write PICTs, but that time has long since passed. Amazingly though, iTunes album art comes out as a PICT with a 512-byte header when you access it through AppleScript