You can query the state of the modifier keys (Control, Shift, Meta, Command (Hyper) and Caps Lock) by calling pane-modifiers-state.
Control
Shift
Meta
Command
Hyper
Caps Lock
CAPI User Guide and Reference Manual (Unix version) - 3 Aug 2017