Documentation
¶
Overview ¶
Package keylayout tracks which key name the current keyboard layout gives each physical key. Platform backends report whole layouts where they can; the input router fills in the rest from unmodified key presses. The io/key package reads it through key.Code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var US = map[string]string{
"KeyA": "A", "KeyB": "B", "KeyC": "C", "KeyD": "D", "KeyE": "E", "KeyF": "F", "KeyG": "G",
"KeyH": "H", "KeyI": "I", "KeyJ": "J", "KeyK": "K", "KeyL": "L", "KeyM": "M", "KeyN": "N",
"KeyO": "O", "KeyP": "P", "KeyQ": "Q", "KeyR": "R", "KeyS": "S", "KeyT": "T", "KeyU": "U",
"KeyV": "V", "KeyW": "W", "KeyX": "X", "KeyY": "Y", "KeyZ": "Z",
"Digit0": "0", "Digit1": "1", "Digit2": "2", "Digit3": "3", "Digit4": "4",
"Digit5": "5", "Digit6": "6", "Digit7": "7", "Digit8": "8", "Digit9": "9",
"Backquote": "`", "Minus": "-", "Equal": "=", "BracketLeft": "[", "BracketRight": "]",
"Backslash": `\`, "Semicolon": ";", "Quote": "'", "Comma": ",", "Period": ".", "Slash": "/",
"IntlBackslash": `\`, "Space": "Space",
"Numpad0": "0", "Numpad1": "1", "Numpad2": "2", "Numpad3": "3", "Numpad4": "4",
"Numpad5": "5", "Numpad6": "6", "Numpad7": "7", "Numpad8": "8", "Numpad9": "9",
}
US is the key name at each physical key on a US QWERTY layout, which is also how codes are named ("KeyQ" is the key QWERTY types Q with).
Functions ¶
func CodeFor ¶
CodeFor guesses the physical key for a key name, as on a US layout, for events from platforms that don't report physical keys.
func Evdev ¶
Evdev names the physical key for a Linux evdev key code, which X11 and Wayland keycodes are offset from by 8. Windows scan codes for the same keys have the same values.
func EvdevCodes ¶
func EvdevCodes() []uint32
EvdevCodes lists the evdev key codes Evdev names, for querying a whole layout.
func Learn ¶
func Learn(code, name string)
Learn records what a key press shows the current layout types with code. Where that isn't what was thought, the layout has changed or was never reported, so a common layout that agrees with the press takes over every key: one press is enough to relabel them all.
Types ¶
This section is empty.