I have working code (here) that traps keycodes for non-modifier keydown events, and modifier-changed events.
But if you do:
LSHIFT down -> RSHIFT down -> RSHIFT up -> LSHIFT up
... the inner 2 actions will not trigger either of these hooks, because the modifier state is not changing!
(EDIT: Woops! I should have tested that out before writing, because actually a new modifier-changed is produced by each actual change.)
My only thought is maybe to additionally watch at an even lower level (here) -- but that doesn't look pretty no matter which angle I look at it from.
-(void)flagsChanged:(NSEvent*)
and check[theEvent modifiers]
. LShift is 131330 and RShift is 131332 – Horologium