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.
How can I detect global key events without using addGlobalMonitorForEventsMatchingMask. I need only the
Share
You could poll
CGEventSourceSecondsSinceLastEventTypefor 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 asaddGlobalMonitorForEventsMatchingMask, which I’m guessing is why you want to avoid it.