objective c - Hotkey when no assistance enabled CGEventTap -


i had used addlocal , work in application, want watch globally tried addglobalmonitorforeventsmatchingmask:handler: nseventkeydown not getting triggered @ all. apparently needs assistive permission enabled.

i able watch nsscrollwheel events globally. interesting.

before put bunch of time , come same roadblock hoping ask first, using cgeventtap monitor key events work globally without assitive turned on?

https://developer.apple.com/library/mac/documentation/carbon/reference/quartzeventservicesref/index.html#//apple_ref/c/tdef/cgeventtaplocation

i explore other methods curious (for learning) if cgeventtap work globally no problems. seems hint here may work comments show confusion: https://stackoverflow.com/a/9345536/1828637

other methods going use carbon apis.

a cgeventtap requires same access assistive devices permissions global event monitor. documentation cgeventtapcreate():

event taps receive key , key down events if 1 of following conditions true:

  • the current process running root user.

  • access assistive devices enabled. in os x v10.4, can enable feature using system preferences, universal access panel, keyboard view.

i recommend using old carbon registereventhotkey() mechanism. still isn't deprecated , available 64-bit. in contrast of carbon. basically, apple recognizes there's no proper replacement, yet.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -