pub fn primary_modifier(mods: &ModifiersState) -> boolExpand description
Returns true when only the platform’s primary modifier key is held
(no Shift, no Alt, and no cross modifier), i.e.:
- macOS:
Cmdpressed;Shift,Alt, andCtrlnot pressed - Windows/Linux:
Ctrlpressed;Shift,Alt, andSupernot pressed
Use this for single-key shortcuts (Cmd+T on macOS / Ctrl+T elsewhere).
Excluding the cross modifier prevents e.g. Ctrl+Cmd+T from triggering a
hardcoded Cmd+T handler on macOS, which would otherwise shadow any
registered Ctrl+Cmd+T keybinding.