You need to create a CGEventTap using Quartz Event Services . The user must have access to assistive devices that make sense, because this is the only legitimate reason for this.
If you want to configure a hotkey, there is an API in the Carbon Event Manager , and a Cocoa shell named SGHotKeysLib.Note that the Carbon Event Manager hotkey API is still supported in the current 64-bit Mac OS X.
source share