Running Dashboard Widgets In-Place

|

By default, when you double-click on a Dashboard widget, or run it from the command line with open(1), a dialog box comes up asking you to install the widget or cancel. If you install it, it gets copied into ~/Library/Widgets/. This widget installer was added somewhere around OS X 10.4.1 or 10.4.2, but it is a big pain if you are a widget developer. It's much more convenient if you can run the widget right in-place without going through the whole installation dialog routine.

It turns out the installer dialog has another mode allow exactly this behavior. I first found this out from Mac OS X Hints, but if you hold down Command and Option, the "Install" button turns into a "Run" button. This runs the widget from right where it is without installing it. Okay, so this is better, but ideally, I wish I could just set some preference so that widgets always run in place. From my little bit of reverse engineering, I could find no such preference, so it was time to bring out the big guns: SIMBL.

SIMBL allows you to build hacks for Cocoa applications by (ab)using input managers. With class-dump, I was able to discover the WidgetInstallerController class with the install: and run: action methods. From some debugging, I was able to deduce that the obvious was true. install: is invoked when the "Install" button was clicked, and run: when the "Run" button was visible and clicked. With this knowledge, I wrote a very short SIMBL plugin that hacks the widget installer to run the widget in-place all the time, without using the mouse at all. Due to the way it works, the dialog box still pops up, but it gets the job done. I don't have a binary available yet, but you can grab the source from my public Subversion repository. You should be able to download a tarball, build it, and copy it to ~/Library/Application Support/SIMBL/Plugins.

blog comments powered by Disqus

About this Entry

This page contains a single entry by Dave published on August 5, 2006 6:09 PM.

Versioning Mac OS X Applications Best Practicies was the previous entry in this blog.

My WWDC 2006 Predicitions is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Links

Powered by Movable Type 4.1