开发者

intercepting keystrokes in OSX

I'd like to be able to listen to keystrokes systemwide in OSX to implement an开发者_StackOverflow社区 utility like AHK on windows (the shortcuts part of AHK anyway), recognizing not only simply combinations of keys, but even more complex things like sequences etc..

I need someone to point me... where to start? How to listen to keybard events system wide? Maybe there's something in the cocoa framework or that's not where to look for?


Quartz event taps. Look up CGEventTapCreate in the Xcode doc viewer to get started. Note that the user must check "Enable access for assistive devices" in the Universal Access preference panel before you'll be able to monitor keyboard events. (And even then you won't see keystrokes within password fields.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜