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
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