I'm getting conflicting reports from various places. Engadget's review says InputManager plug-ins being completely ignored (and causing strange behaviour if the application is loaded in 32-bit mode), but this mailing list thread says they will work if the 32/64-bit compatibility is right.
So I have two questions:
- Do we get to use InputManagers in Snow Leopard?
- If yes, will it work the same way as in Leopard. And if no, what is good a workaround (because 1Password is apparently working on a fix)?
If you really need to inject code into applications to accomplish what you're trying to do, use mach_inject.
And please file a bug requesting hooks so you can implement your software in a safer way in future.
http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSInputManager
The automatic loading of bundles located in InputManagers folders is now officially unsupported. The conditions for valid input manager bundle is further tightened. This functionality is likely to be disabled in a future release.
The valid installation is now restricted to the /Library/InputManagers folder only. Bundles in other locations are silently ignored.
All the files in the bundle and /Library/InputManagers folder itself must be owned by the root user and admin group. No files inside the bundle can have group or other write permissions.
Processes running with the root privilege (getuid() == 0 or geteuid() == 0) cannot load any bundle input manager.
Processes running with the wheel group privilege cannot load any bundle input manager.
The process must be in the active workspace session at the time of loading the bundles.
The process must not be tainted by changing user or group id (checked by issetugid()).
No 64-bit processes can load any bundle input managers.
It looks like Chax (an InputManager plugin for iChat) has switched now to being an app launcher for iChat: you run Chax.app and it loads iChat with extra UI hacks.
Quickly looking at the strings in the tiny launcher binary Chax.app/Contents/MacOS/Chax, it seems like he's choosing an easier library interception technique than the already-mentioned mach_inject: instead you just set the DYLD_INSERT_LIBRARIES environment variable before launching your target app (like LD_PRELOAD in Linux).
Of course, this doesn't make my favorite InputManagers, MultiClutch and Afloat, work again in Snow Leopard — they were most useful because they worked with all Cocoa apps. Still not sure what the best workaround would be for these apps.
I didn't download the 1Password 3 beta to try and see what they were doing, because it looked like you have to sign a virtual NDA first.
1Password 3.0 works around the need for an InputManager by piggybacking on Safari’s browser plug-in API instead. The linked article also provides a very pragmatic comparison of various code-injection alternatives to InputManagers.
来源:https://stackoverflow.com/questions/1338978/inputmanager-plug-ins-in-snow-leopard-os-x-10-6