In macos I have the following code to detect if the user is typing (literally if the user is typing any key):
[NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDown
handler:^(NSEvent *event){
NSLog(@"keydown: %@", event.characters);
}];
This code absolutely does not work. Is there an alternative to NSKeyDown for global monitor?