Reputation: 1541
How can I detect global key events without using addGlobalMonitorForEventsMatchingMask. I need only the notification that a key was pressed, do not need to know which key exactly.
Upvotes: 0
Views: 546
Reputation: 22707
You could poll CGEventSourceSecondsSinceLastEventType
for the time since the last keyboard event. I don't know of any way to be notified of a key event without finding out what key was pressed. A Quartz event tap would have the same security restrictions as addGlobalMonitorForEventsMatchingMask
, which I'm guessing is why you want to avoid it.
Upvotes: 1