The controls, Shift, Command, and Option on OS X do not generate NSKeyDown/kCGEventKeyDown . Instead, you can get the NSFlagsChanged/kCGEventFlagsChanged .
That is, โusuallyโ, if the user typed Option-T and you scan for keyDown events, you will see only the โTโ event, which includes the fact that the option key โmodifiesโ it.
If you want to receive flagsChanged events, you can get this by clicking an event or in NSResponder somewhere. The flagsChanged event tells you a new collection of modifiers (shift / command / etc). In this case, it is useful to save a local copy of the previous modifiers so that you can see which particular key has gone down or up.
source share