Global hotkey API in Cocoa

Originator:amorya
Number:rdar://14455291 Date Originated:16-Jul-2013 03:22 PM
Status:Open Resolved:
Product:OS X SDK Product Version:10.8
Classification:Feature (New) Reproducible:Not Applicable
 
A lot of apps wish to respond to a single user-chosen key combination. For example, a calendar app may use such a key combination to open a window to allow the user to enter a new event.

Currently, one can use Carbon to do this (or a third party library that wraps Carbon). Alternatively, one could use addGlobalMonitorForEventsMatchingMask:handler: on NSEvent, but that has security implications and is only allowed if accessibility is enabled.

I would like an API where the app can hand it a key combination (that must contain at least one modifier key), and then a callback to that app is made whenever that key combo is pressed.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!