How to be alerted when user presses a modifier key ?

If the user presses only modifiers key (shift, alt, command, …) the keyDown/keyUp methods of the first responder are not called. What to do if I need to be notified of these events ?
also implements a - (void)flagsChanged:(NSEvent *)theEvent method:
"Informs the receiver that the user has pressed or released a modifier key (Shift, Control, and so on) specified by theEvent. NSResponder’s implementation simply passes this message to the next responder."
NSResponder

Authored by: Anonymous on Friday, June 04 2004 @ 05:17 PM BST
Can you not install a flagsChanged handler on the NSApplication's
Delegate? I believe the Application delegate is the last resort of the
responder chain so it should receive the Flags changed event before it is
lost to the ether.