I wanna intercept hotkeys that begin with Control+Shift and ends with a character (mandatory).
I have the following code:
[NSEvent addGlobalMonitorForEventsMatchingMask:NSFlagsChangedMask handler: ^(NSEvent *event) {
NSUInteger flags = [event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
if(flags == NSControlKeyMask + NSShiftKeyMask){
NSLog(@"pressed!");
}
}];
What do i need to add to my code to check if the user pressed ControlShift+character, and what character the user pressed?
The code NSLog(@"pressed!");
will be executed only if what i said above is true.
This is my pseudo-code for what i'm looking for:
[NSEvent addGlobalMonitorForEventsMatchingMask:NSFlagsChangedMask handler: ^(NSEvent *event) {
NSUInteger flags = [event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
if((flags == NSControlKeyMask + NSShiftKeyMask) && [event containsCharacter]){
NSLog(@"%@", [event character];
}
}];
So if the user presses Control+Shift+1 i'll do one thing, if Control+Shift+2 other thing, and so on...