I did set the necessary privileges for the app, and for some events it is working.
For instance:
NSEvent.addGlobalMonitorForEvents(matching: .flagsChanged) {
print("\($0)")
}
works, but
NSEvent.addGlobalMonitorForEvents(matching: .keyDown) {
print("\($0)")
}
doesn't.
So I am wondering, is it possible at all to listen globally for any keypress?