The Pug Automatic

OS X icon transparency and Tasks bundle file icon

Written August 16, 2007. Tagged OS X, TextMate, Annoyances, Design.

This is a multi-purpose post: a workaround for the poor icon handling in OS X and a pretty icon for my Tasks bundle.

Tasks bundle icon

I got tired of the generic blank document icon for my Tasks bundle .todo files, so I custom-made one:

[Icon] todo.icns

There is an official TextMate document icon template somewhere, but until I get an URL for that, here is the Photoshop psd I made from an existing icon: textmate.icns.psd.

To convert the psd file to an .icns file, I used Icon Composer which ships with the (free) Apple Developer Tools. Just drag the PSD to the largest slot in the Icon Composer window, then drag from there to each smaller slot in turn, using scaled versions and extracting masks when prompted.

OS X icon woes

I love many things about OS X, but the icon handling is really, really horrible.

What I would really like to do is make all files with the .todo extension use this icon. However, after googling it, it seems like I would have to modify TextMate itself and have my changes overwritten at every update, or convince the TextMate author to include my icon and file extension settings.

So I settled for something less painful: since I keep rather few to-do lists, I can set the icon individually for each such file.

Changing the icon for a file (including e.g. drives, devices and applications) in OS X is a matter of opening the info window for the file (⌘I), selecting the icon in the top-left and pasting something there. It's a pretty cute solution, though very non-obvious. Oh, and it sucks: if I've copied an image with transparency from Photoshop, pasting it in the info window will not preserve the transparency. The icon gets a solid background color. Same thing happens when I copy from Preview or from the image's info window.

If I open the info window for an .icns, it bears an "icns" icon rather than itself.

Update 2007-08-16
Dragging-and-dropping an icon file to the excellent freeware app icns2icon (thanks, Andrew!) makes it appear as its own info window icon, greatly simplifying things.

Leaving the kludge below to scare children.

It's something of a bootstrapping problem: what we really need is a file bearing the icon, to copy it from.


The workaround I came up with relies on the fact that the only thing I'd been able to successfully set icons for, transparency and all, were applications, by replacing their bundled icon file with a new one.

Go to /Applications and duplicate (⌘D) some app, perhaps Photo Booth. Right-click the copy and "Show Package Contents". Swap Contents/Resources/PhotoBooth.icns for your own icon, using the same filename. You may need to restart Finder or even log out and back in to get its info panel icon to change.

Once the change kicks in, I can then copy the new icon from the info window to whatever file I wish, with transparency intact.

This workaround is ugly for sure, but I've yet to find something else that works. Please let me know if you're aware of a better solution.