The Shape of Everything
A website mostly about Mac stuff, written by Gus Mueller
» Acorn
» Retrobatch
» Twitter
» Micro.blog
» Mastodon
» Instagram
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
May 28, 2008
(This post is from my old, old, super old site. My views have changed over the years, hopefully my writing has improved, and there is now more than a handful of folks reading my site. Enjoy.)

I was trying out some new icons in the dock Brad was working on, and found that it's a bit annoying having to relaunch an app to test this. So what I needed was an app that would update it's icon in the dock with a new image, without having to relaunch it. I swear one of the Apple supplied dev tools would do this, but I can't find it anywhere.

Then Paul Kim pointed me to his Status Item Tester which does exactly what I wanted. Much easier. Just drag and drop out of Acorn into his window and it does the trick.

Then I remembered.. hey- Acorn has a plugin API, doesn't it? Why yes, I'm pretty sure it does!

10 seconds later, the "Make Dock Icon" plugin was born:

from AppKit import *

ACScriptSuperMenuTitle = None
ACScriptMenuTitle = "Make Dock Icon"

def main(image):
  NSApplication.sharedApplication().setApplicationIconImage_(image.NSImage())
  return nil

It really is that easy to write useful plugins for Acorn. Well, at least in this case- useful for developer types like myself. And there's a handful of examples on the Acorn wiki if you're interested in making your own.