I am unable to get the keyboard keys events in the background or Inactive state of the mac application. I am trying to get the global event using
NSEvent.addGlobalMonitorForEvent(matching: [.keyDown], handler: {
event in print("key pressed : \(event.keyCode)")
return event
})
This is working for mouse tracking but unable to track the events for keyboard...;(
Please help me to track the event for the keyboard events in active/inactive and background.