Skip to main content

Module keys

Module keys 

Expand description

One spelling for a key: the token a shortcut declares (Ctrl+Enter), the token a live press answers to (enter), and the key a test drives (Enter).

A shortcut is written by a person and matched against a press, which winit reports as a named key or a character. Both sides read their key through canonical, so Esc, escape and the Escape key are one press, and so are Space and the space bar.

Functions§

canonical
key as one token: its token when it is a live key, else the name a shortcut writes, in the same spelling. Esc and Escape, Space and " ", Up and ArrowUp, E and e are each one token.
parse
The key spec names, as a driver or a typed shortcut writes it: Enter, Tab, Escape, the arrows, F1–F12, Home, End, PageUp, PageDown, Delete, Space and the rest; one character is that character typed (" " is the space bar’s character, "Space" the key).
token
The token key answers to, or None for a key no shortcut can name (a modifier pressed on its own, a media key).