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 (Macintosh version) - 01 Dec 2021 19:31:25