08/31/2009 Update: For Snow Leopard compatibility, see here.
08/13/2009 Update: It should now work with all future versions of Safari without having to update it again. Read about the change here.
06/09/2009 Update: I have just updated the plugin distribution to work with the just-released production version of Safari 4. If you have problems with it, please let me know.
03/05/2009 Update: It’s working again.
02/27/2009 Update: This plugin is not working with the just-released Safari Beta 4. I know this. I will have to spend some time with the beta before I know why it broke. I will try to find time to take a whack at it this weekend.
I love Safari on my shiny Mac Pro, particularly because it’s so much faster than Firefox. But one thing I missed from Firefox was being able to do a middle-click on a tab and have it close. After several failed attempts, I finally got some help from Mark Rowe who pointed me to a proper method-swizzling implementation. After switching my code to use that swizzler, everything fell into place. I’ve been happily using it ever since, I just never released it. I got an email the other day asking for it, so here it is.
Unlike my Export to Archive plugin for iPhoto, I didn’t build an installer for this one. It’s easy to install, but you still have to do it yourself. And there’s a dependency: SIMBL. Now, before Leopard shipped the word was that Input Managers would no longer be supported. After Leopard shipped we saw that wasn’t entirely true. So, once you get SIMBL installed and working, using my plugin is easy. This should work on both Tiger and Leopard. I’ve only tested it recently on Leopard, but I originally wrote it on a Tiger system.
- Get the binary package: MiddleClickClose.zip
- Create ~/Library/Application Support/SIMBL/Plugins if it doesn’t exist
- Unzip the MiddleClickClose.zip into this directory. You should end up with a directory called MiddleClickClose.bundle
- Restart Safari
If all goes well, you should now be able to use your middle mouse button to close Safari tabs. It works for me. If it doesn’t work for you, run the OSX Console and look for “MiddleClickClose loaded” in the “Console Messages” section.
If you want the source code, download it here.
I should mention that this really is a dirty hack, and may not work with future versions of Leopard. It works for me, but your mileage may vary. I hope it works for you, but it may not.
This code is distributed under the GPL v2.