Skip to main content

parse_shortcut

Function parse_shortcut 

Source
pub fn parse_shortcut(label: &str) -> Option<Shortcut>
Expand description

Parse a shortcut label of the form "Modifier+Modifier+Key" (e.g. "Ctrl+Shift+Space", "Alt+F1", "Cmd+K") into a [Shortcut].

Recognized modifiers (case-insensitive): ctrl/control, alt/option, shift, cmd/command/super/meta. Recognized keys: single ASCII letters and digits, space, enter/return, tab, escape/esc, arrow keys (up/down/left/right), and f1-f12. Returns None for an empty label, a label with no key segment, or an unrecognized modifier/key token.