Expand description
Keyboard shortcuts as Bern writes them: the modifiers cmd (the
primary modifier: Command on Apple systems, Control elsewhere), ctrl,
alt and shift, then one key, joined by +, such as "cmd+k" or
"space". Declarations write them as literals, which the compiler
normalizes; a shortcut that follows state is a text in the same form,
which engines normalize with parse_shortcut before they keep it, and
every runtime reads by the same rules.
Constants§
- SHORTCUT_
KEYS - Keys a shortcut may name besides a single printable character.
Functions§
- parse_
shortcut - Normalize a keyboard shortcut: modifiers
cmd,ctrl,altandshiftin that order, then one key: a printable character in lower case or one ofSHORTCUT_KEYS. Case and spaces around the parts do not matter, so"Shift + Cmd + K"is"cmd+shift+k". - same_
keys - Whether two shortcuts are pressed with the same keys on a system that is
(
apple) or is not an Apple one: elsewherecmdis Control, socmd+kandctrl+kare one shortcut there. Texts that are no shortcut are the same as nothing else.