Today I had a few hours spare time, so I took a look at SIMBL.
SIMBL is a small framework to inject your own code into Cocoa applications. A similar system is used by the super awesome TotalFinder and TotalTerminal.
The Google Code project page includes a very short tutorial on how to create such a SIMBL bundle. First I thought it can’t be that easy – but it definitely is!
Just create a new Xcode bundle project and update the Info.plist file according the given specification:
<key>SIMBLTargetApplications</key> <array> <dict> <key>BundleIdentifier</key> <string>com.apple.Safari</string> <key>MaxBundleVersion</key> <string>412</string> <key>MinBundleVersion</key> <string>412</string> </dict> </array>
After that add the following “callback” methode to your projekt:
+ (void) load { // your code }
That’s it! Now do whatever you want to do 😉
To test your bundle just copy it to one of the following folders …
/Library/Application Support/SIMBL/Plugins /Users/Username/Library/Application Support/SIMBL/Plugins
… and start the application. SIMBL will take care of loading the correct plugin (by checking the bundle identifier) and calls your load method.