Compare commits

..

2 Commits

Author SHA1 Message Date
Marc Brooks b373605b20
Merge 94f6bbd27a into 8527b1eff1 2025-08-19 10:06:47 -05:00
Marc Brooks 94f6bbd27a
Add ability to track modifier state on the device
Remove LED sync source and add keypress reporting
We return the modifiers as the valid bitmask so that the VirtualKeyboard can represent the correct keys as down. This is important when we have strokes like Left-Control + Right-Control + Keypad-1 (used in switching KVMs and such)
Fix handling of meta keys in client
Ran go modernize
Morphs Interface{} to any
Ranges over SplitSeq and FieldSeq for iterating splits
Used min for end calculation remote_mount.Read
Used range 16 in wol.createMagicPacket
DID NOT apply the Omitempty cleanup.
Use the KeysDownState for the infobar
Strong typed in the typescript realm.
Enable still working with devices that haven't been upgraded
Return the KeysDownState from keyboardReport
Clear out the hidErrorRollOver once sent to reset the keyboard to nothing down.
Handles the returned KeysDownState from keyboardReport
Now passes all logic through handleKeyPress.
If we get a state back from a keyboardReport, use it and also enable keypressReport because we now know it's an upgraded device.
Add documentation on the legacy support.
Cleanup react state management to enable upgrading Zustand
2025-08-15 16:21:43 -05:00
4 changed files with 55 additions and 359 deletions

View File

@ -262,7 +262,7 @@ function KeyboardWrapper() {
"Tab KeyQ KeyW KeyE KeyR KeyT KeyY KeyU KeyI KeyO KeyP BracketLeft BracketRight Backslash", "Tab KeyQ KeyW KeyE KeyR KeyT KeyY KeyU KeyI KeyO KeyP BracketLeft BracketRight Backslash",
"CapsLock KeyA KeyS KeyD KeyF KeyG KeyH KeyJ KeyK KeyL Semicolon Quote Enter", "CapsLock KeyA KeyS KeyD KeyF KeyG KeyH KeyJ KeyK KeyL Semicolon Quote Enter",
"ShiftLeft KeyZ KeyX KeyC KeyV KeyB KeyN KeyM Comma Period Slash ShiftRight", "ShiftLeft KeyZ KeyX KeyC KeyV KeyB KeyN KeyM Comma Period Slash ShiftRight",
"ControlLeft MetaLeft AltLeft Space AltRight MetaRight CtrlRight", "ControlLeft AltLeft MetaLeft Space MetaRight AltRight",
], ],
shift: [ shift: [
"CtrlAltDelete AltMetaEscape CtrlAltBackspace", "CtrlAltDelete AltMetaEscape CtrlAltBackspace",
@ -271,7 +271,7 @@ function KeyboardWrapper() {
"Tab (KeyQ) (KeyW) (KeyE) (KeyR) (KeyT) (KeyY) (KeyU) (KeyI) (KeyO) (KeyP) (BracketLeft) (BracketRight) (Backslash)", "Tab (KeyQ) (KeyW) (KeyE) (KeyR) (KeyT) (KeyY) (KeyU) (KeyI) (KeyO) (KeyP) (BracketLeft) (BracketRight) (Backslash)",
"CapsLock (KeyA) (KeyS) (KeyD) (KeyF) (KeyG) (KeyH) (KeyJ) (KeyK) (KeyL) (Semicolon) (Quote) Enter", "CapsLock (KeyA) (KeyS) (KeyD) (KeyF) (KeyG) (KeyH) (KeyJ) (KeyK) (KeyL) (Semicolon) (Quote) Enter",
"ShiftLeft (KeyZ) (KeyX) (KeyC) (KeyV) (KeyB) (KeyN) (KeyM) (Comma) (Period) (Slash) ShiftRight", "ShiftLeft (KeyZ) (KeyX) (KeyC) (KeyV) (KeyB) (KeyN) (KeyM) (Comma) (Period) (Slash) ShiftRight",
"ControlLeft MetaLeft AltLeft Space AltRight MetaRight CtrlRight", "ControlLeft AltLeft MetaLeft Space MetaRight AltRight",
], ],
}} }}
disableButtonHold={true} disableButtonHold={true}
@ -287,8 +287,8 @@ function KeyboardWrapper() {
onKeyPress={onKeyDown} onKeyPress={onKeyDown}
display={keyDisplayMap} display={keyDisplayMap}
layout={{ layout={{
default: ["PrintScreen ScrollLock Pause", "Insert Home PageUp", "Delete End PageDown"], default: ["PrintScreen ScrollLock Pause", "Insert Home Pageup", "Delete End Pagedown"],
shift: ["(PrintScreen) ScrollLock (Pause)", "Insert Home PageUp", "Delete End PageDown"], shift: ["(PrintScreen) ScrollLock (Pause)", "Insert Home Pageup", "Delete End Pagedown"],
}} }}
syncInstanceInputs={true} syncInstanceInputs={true}
debug={false} debug={false}

View File

@ -1,13 +1,7 @@
export interface KeyStroke { modifier: number; keys: number[]; } export interface KeyStroke { modifier: number; keys: number[]; }
export interface KeyInfo { key: string | number; shift?: boolean, altRight?: boolean } export interface KeyInfo { key: string | number; shift?: boolean, altRight?: boolean }
export interface KeyCombo extends KeyInfo { deadKey?: boolean, accentKey?: KeyInfo } export interface KeyCombo extends KeyInfo { deadKey?: boolean, accentKey?: KeyInfo }
export interface KeyboardLayout { export interface KeyboardLayout { isoCode: string, name: string, chars: Record<string, KeyCombo> }
isoCode: string,
name: string,
chars: Record<string, KeyCombo>,
keyDisplayMap: Record<string, string>,
virtualKeyboard: { main: { default: string[], shift: string[] }, control?: { default: string[], shift?: string[] }, controlSection?: { default: string[], shift?: string[] } }
}
// to add a new layout, create a file like the above and add it to the list // to add a new layout, create a file like the above and add it to the list
import { cs_CZ } from "@/keyboardLayouts/cs_CZ" import { cs_CZ } from "@/keyboardLayouts/cs_CZ"

View File

@ -1,16 +1,8 @@
import { KeyboardLayout, KeyCombo } from "../keyboardLayouts" import { KeyboardLayout, KeyCombo } from "../keyboardLayouts"
const name = "English (US)"; const name = "English (US)";
const isoCode = "en-US";
// dead keys const chars = {
const keyAcute = { key: "Quote", control: true, menu: true, mark: "´" } // acute accent
const keyCedilla = { key: ".", shift: true, alt: true, mark: "¸" } // cedilla accent
const keyComma = { key: "BracketRight", shift: true, altRight: true, mark: "," } // comma accent
const keyDiaeresis = { key: "Quote", shift: true, control: true, menu: true, mark: "¨" } // diaeresis accent
const keyDegree = { key: "Semicolon", shift: true, control: true, menu: true, mark: "°" } // degree accent
export const chars = {
A: { key: "KeyA", shift: true }, A: { key: "KeyA", shift: true },
B: { key: "KeyB", shift: true }, B: { key: "KeyB", shift: true },
C: { key: "KeyC", shift: true }, C: { key: "KeyC", shift: true },
@ -97,197 +89,31 @@ export const chars = {
">": { key: "Period", shift: true }, ">": { key: "Period", shift: true },
";": { key: "Semicolon" }, ";": { key: "Semicolon" },
":": { key: "Semicolon", shift: true }, ":": { key: "Semicolon", shift: true },
"¶": { key: "Semicolon", altRight: true }, // pilcrow sign
"[": { key: "BracketLeft" }, "[": { key: "BracketLeft" },
"{": { key: "BracketLeft", shift: true }, "{": { key: "BracketLeft", shift: true },
"«": { key: "BracketLeft", altRight: true }, // double left quote sign
"]": { key: "BracketRight" }, "]": { key: "BracketRight" },
"}": { key: "BracketRight", shift: true }, "}": { key: "BracketRight", shift: true },
"»": { key: "BracketRight", altRight: true }, // double right quote sign
"\\": { key: "Backslash" }, "\\": { key: "Backslash" },
"|": { key: "Backslash", shift: true }, "|": { key: "Backslash", shift: true },
"¬": { key: "Backslash", altRight: true }, // not sign
"`": { key: "Backquote" }, "`": { key: "Backquote" },
"~": { key: "Backquote", shift: true }, "~": { key: "Backquote", shift: true },
"§": { key: "IntlBackslash" }, "§": { key: "IntlBackslash" },
"±": { key: "IntlBackslash", shift: true }, "±": { key: "IntlBackslash", shift: true },
" ": { key: "Space" }, " ": { key: "Space", shift: false },
"\n": { key: "Enter" }, "\n": { key: "Enter", shift: false },
Enter: { key: "Enter" }, Enter: { key: "Enter", shift: false },
Escape: { key: "Escape" }, Tab: { key: "Tab", shift: false },
Tab: { key: "Tab" }, PrintScreen: { key: "Prt Sc", shift: false },
PrintScreen: { key: "Prt Sc" },
SystemRequest: { key: "Prt Sc", shift: true }, SystemRequest: { key: "Prt Sc", shift: true },
ScrollLock: { key: "ScrollLock" }, ScrollLock: { key: "ScrollLock", shift: false},
Pause: { key: "Pause" }, Pause: { key: "Pause", shift: false },
Break: { key: "Pause", shift: true }, Break: { key: "Pause", shift: true },
Insert: { key: "Insert" }, Insert: { key: "Insert", shift: false },
Delete: { key: "Delete" }, Delete: { key: "Delete", shift: false },
} as Record<string, KeyCombo> } as Record<string, KeyCombo>
export const keyDisplayMap: Record<string, string> = {
CtrlAltDelete: "Ctrl + Alt + Delete",
AltMetaEscape: "Alt + Meta + Escape",
CtrlAltBackspace: "Ctrl + Alt + Backspace",
Escape: "Esc",
Tab: "Tab",
Backspace: "Backspace",
"(Backspace)": "Backspace",
Enter: "Enter",
CapsLock: "Caps Lock",
ShiftLeft: "Shift",
ShiftRight: "Shift",
ControlLeft: "Ctrl",
AltLeft: "Alt",
AltRight: "Alt",
AltGraph: "AltGr",
MetaLeft: "Meta",
MetaRight: "Meta",
Space: " ",
Insert: "Insert",
Home: "Home",
PageUp: "PgUp",
Delete: "Delete",
End: "End",
PageDown: "PgDn",
Clear: "Clear",
ArrowLeft: "←",
ArrowRight: "→",
ArrowUp: "↑",
ArrowDown: "↓",
// Letters
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",
// Capital letters
"(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",
// Numbers
Digit1: "1", Digit2: "2", Digit3: "3", Digit4: "4", Digit5: "5",
Digit6: "6", Digit7: "7", Digit8: "8", Digit9: "9", Digit0: "0",
// Shifted Numbers
"(Digit1)": "!", "(Digit2)": "@", "(Digit3)": "#", "(Digit4)": "$", "(Digit5)": "%",
"(Digit6)": "^", "(Digit7)": "&", "(Digit8)": "*", "(Digit9)": "(", "(Digit0)": ")",
// Symbols
Minus: "-",
"(Minus)": "_",
Equal: "=",
"(Equal)": "+",
BracketLeft: "[",
"(BracketLeft)": "{",
BracketRight: "]",
"(BracketRight)": "}",
Backslash: "\\",
"(Backslash)": "|",
Semicolon: ";",
"(Semicolon)": ":",
Quote: "'",
"(Quote)": "\"",
Comma: ",",
"(Comma)": "<",
Period: ".",
"(Period)": ">",
Slash: "/",
"(Slash)": "?",
Backquote: "`",
"(Backquote)": "~",
IntlBackslash: "\\",
// Function keys
F1: "F1", F2: "F2", F3: "F3", F4: "F4",
F5: "F5", F6: "F6", F7: "F7", F8: "F8",
F9: "F9", F10: "F10", F11: "F11", F12: "F12",
// Numpad
Numpad0: "Num 0", Numpad1: "Num 1", Numpad2: "Num 2",
Numpad3: "Num 3", Numpad4: "Num 4", Numpad5: "Num 5",
Numpad6: "Num 6", Numpad7: "Num 7", Numpad8: "Num 8",
Numpad9: "Num 9", NumpadAdd: "Num +", NumpadSubtract: "Num -",
NumpadMultiply: "Num *", NumpadDivide: "Num /", NumpadDecimal: "Num .",
NumpadEqual: "Num =", NumpadEnter: "Num Enter", NumpadInsert: "Ins",
NumpadDelete: "Del", NumLock: "Num Lock",
// Modals
PrintScreen: "PrtSc", ScrollLock: "Scroll Lock", Pause: "Pause",
"(PrintScreen)": "SysRq", "(Pause)": "Break",
SystemRequest: "SysRq", Break: "Break"
};
export const virtualKeyboard = {
main: {
default: [
"CtrlAltDelete AltMetaEscape CtrlAltBackspace",
"Escape F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12",
"Backquote Digit1 Digit2 Digit3 Digit4 Digit5 Digit6 Digit7 Digit8 Digit9 Digit0 Minus Equal Backspace",
"Tab KeyQ KeyW KeyE KeyR KeyT KeyY KeyU KeyI KeyO KeyP BracketLeft BracketRight Backslash",
"CapsLock KeyA KeyS KeyD KeyF KeyG KeyH KeyJ KeyK KeyL Semicolon Quote Enter",
"ShiftLeft KeyZ KeyX KeyC KeyV KeyB KeyN KeyM Comma Period Slash ShiftRight",
"ControlLeft MetaLeft AltLeft Space AltGr MetaRight Menu ControlRight",
],
shift: [
"CtrlAltDelete AltMetaEscape CtrlAltBackspace",
"Escape F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12",
"(Backquote) (Digit1) (Digit2) (Digit3) (Digit4) (Digit5) (Digit6) (Digit7) (Digit8) (Digit9) (Digit0) (Minus) (Equal) (Backspace)",
"Tab (KeyQ) (KeyW) (KeyE) (KeyR) (KeyT) (KeyY) (KeyU) (KeyI) (KeyO) (KeyP) (BracketLeft) (BracketRight) (Backslash)",
"CapsLock (KeyA) (KeyS) (KeyD) (KeyF) (KeyG) (KeyH) (KeyJ) (KeyK) (KeyL) (Semicolon) (Quote) Enter",
"ShiftLeft (KeyZ) (KeyX) (KeyC) (KeyV) (KeyB) (KeyN) (KeyM) (Comma) (Period) (Slash) ShiftRight",
"ControlLeft MetaLeft AltLeft Space AltGr MetaRight Menu ControlRight",
]
},
controlSection: {
default: [
"PrintScreen ScrollLock Pause",
"Insert Home PageUp",
"Delete End PageDown"
],
shift: [
"(PrintScreen) ScrollLock (Pause)",
"Insert Home PageUp",
"Delete End PageDown"
],
},
simpleArrows: {
default: [
"ArrowUp",
"ArrowLeft ArrowDown ArrowRight"],
},
numpad: {
numlocked: [
"NumLock NumpadDivide NumpadMultiply NumpadSubtract",
"Numpad7 Numpad8 Numpad9 NumpadAdd",
"Numpad4 Numpad5 Numpad6",
"Numpad1 Numpad2 Numpad3 NumpadEnter",
"Numpad0 NumpadDecimal",
],
default: [
"NumLock NumpadDivide NumpadMultiply NumpadSubtract",
"Home ArrowUp PageUp NumpadAdd",
"ArrowLeft Clear ArrowRight",
"End ArrowDown PageDown NumpadEnter",
"NumpadInsert NumpadDelete",
],
}
}
export const en_US: KeyboardLayout = { export const en_US: KeyboardLayout = {
isoCode, isoCode: "en-US",
name, name: name,
chars, chars: chars
keyDisplayMap,
modifierDisplayMap,
virtualKeyboard
}; };

View File

@ -1,39 +1,20 @@
// Key codes and modifiers correspond to definitions in the // Key codes and modifiers correspond to definitions in the
// [Linux USB HID gadget driver](https://www.kernel.org/doc/Documentation/usb/gadget_hid.txt) // [Linux USB HID gadget driver](https://www.kernel.org/doc/Documentation/usb/gadget_hid.txt)
// [Universal Serial Bus HID Usage Tables: Section 10](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf) // [Section 10. Keyboard/Keypad Page 0x07](https://usb.org/sites/default/files/hut1_21.pdf)
// These are all the key codes (not scan codes) that an 85/101/102 keyboard might have on it
export const keys = { export const keys = {
Again: 0x79,
AlternateErase: 0x9d,
AltGraph: 0xe5,
AltLeft: 0xe2,
AltRight: 0xe6,
Application: 0x65,
ArrowDown: 0x51, ArrowDown: 0x51,
ArrowLeft: 0x50, ArrowLeft: 0x50,
ArrowRight: 0x4f, ArrowRight: 0x4f,
ArrowUp: 0x52, ArrowUp: 0x52,
Attention: 0x9a,
Backquote: 0x35, // aka Grave Backquote: 0x35, // aka Grave
Backslash: 0x31, Backslash: 0x31,
Backspace: 0x2a, Backspace: 0x2a,
BracketLeft: 0x2f, // aka LeftBrace BracketLeft: 0x2f, // aka LeftBrace
BracketRight: 0x30, // aka RightBrace BracketRight: 0x30, // aka RightBrace
Cancel: 0x9b,
CapsLock: 0x39, CapsLock: 0x39,
Clear: 0x9c,
ClearAgain: 0xa2,
Comma: 0x36, Comma: 0x36,
Compose: 0xe3, Compose: 0x65,
ContextMenu: 0x65, ContextMenu: 0x65, // same as Compose
ControlLeft: 0xe0,
ControlRight: 0xe4,
Copy: 0x7c,
CrSel: 0xa3,
CurrencySubunit: 0xb5,
CurrencyUnit: 0xb4,
Cut: 0x7b,
DecimalSeparator: 0xb3,
Delete: 0x4c, Delete: 0x4c,
Digit0: 0x27, Digit0: 0x27,
Digit1: 0x1e, Digit1: 0x1e,
@ -49,8 +30,6 @@ export const keys = {
Enter: 0x28, Enter: 0x28,
Equal: 0x2e, Equal: 0x2e,
Escape: 0x29, Escape: 0x29,
Execute: 0x74,
ExSel: 0xa4,
F1: 0x3a, F1: 0x3a,
F2: 0x3b, F2: 0x3b,
F3: 0x3c, F3: 0x3c,
@ -75,21 +54,9 @@ export const keys = {
F22: 0x71, F22: 0x71,
F23: 0x72, F23: 0x72,
F24: 0x73, F24: 0x73,
Find: 0x7e,
Grave: 0x35,
HashTilde: 0x32, // non-US # and ~
Help: 0x75,
Home: 0x4a, Home: 0x4a,
HashTilde: 0x32, // non-US # and ~
Insert: 0x49, Insert: 0x49,
International1: 0x87,
International2: 0x88,
International3: 0x89,
International4: 0x8a,
International5: 0x8b,
International6: 0x8c,
International7: 0x8d,
International8: 0x8e,
International9: 0x8f,
IntlBackslash: 0x64, // non-US \ and | IntlBackslash: 0x64, // non-US \ and |
KeyA: 0x04, KeyA: 0x04,
KeyB: 0x05, KeyB: 0x05,
@ -117,27 +84,10 @@ export const keys = {
KeyX: 0x1b, KeyX: 0x1b,
KeyY: 0x1c, KeyY: 0x1c,
KeyZ: 0x1d, KeyZ: 0x1d,
LockingCapsLock: 0x82, KeypadExclamation: 0xcf,
LockingNumLock: 0x83,
LockingScrollLock: 0x84,
Lang1: 0x90, // Hangul/English toggle on Korean keyboards
Lang2: 0x91, // Hanja conversion on Korean keyboards
Lang3: 0x92, // Katakana on Japanese keyboards
Lang4: 0x93, // Hiragana on Japanese keyboards
Lang5: 0x94, // Zenkaku/Hankaku toggle on Japanese keyboards
Lang6: 0x95,
Lang7: 0x96,
Lang8: 0x97,
Lang9: 0x98,
Menu: 0x76,
MetaLeft: 0xe3,
MetaRight: 0xe7,
Minus: 0x2d, Minus: 0x2d,
Mute: 0x7f,
NumLock: 0x53, // and Clear NumLock: 0x53, // and Clear
Numpad0: 0x62, // and Insert Numpad0: 0x62, // and Insert
Numpad00: 0xb0,
Numpad000: 0xb1,
Numpad1: 0x59, // and End Numpad1: 0x59, // and End
Numpad2: 0x5a, // and Down Arrow Numpad2: 0x5a, // and Down Arrow
Numpad3: 0x5b, // and Page Down Numpad3: 0x5b, // and Page Down
@ -148,109 +98,38 @@ export const keys = {
Numpad8: 0x60, // and Up Arrow Numpad8: 0x60, // and Up Arrow
Numpad9: 0x61, // and Page Up Numpad9: 0x61, // and Page Up
NumpadAdd: 0x57, NumpadAdd: 0x57,
NumpadAnd: 0xc7,
NumpadAt: 0xce,
NumpadBackspace: 0xbb,
NumpadBinary: 0xda,
NumpadCircumflex: 0xc3,
NumpadClear: 0xd8,
NumpadClearEntry: 0xd9,
NumpadColon: 0xcb,
NumpadComma: 0x85, NumpadComma: 0x85,
NumpadDecimal: 0x63, NumpadDecimal: 0x63,
NumpadDecimalBase: 0xdc,
NumpadDelete: 0x63,
NumpadDivide: 0x54, NumpadDivide: 0x54,
NumpadDownArrow: 0x5a,
NumpadEnd: 0x59,
NumpadEnter: 0x58, NumpadEnter: 0x58,
NumpadEqual: 0x67, NumpadEqual: 0x67,
NumpadExclamation: 0xcf,
NumpadGreaterThan: 0xc6,
NumpadHexadecimal: 0xdd,
NumpadHome: 0x5f,
NumpadKeyA: 0xbc,
NumpadKeyB: 0xbd,
NumpadKeyC: 0xbe,
NumpadKeyD: 0xbf,
NumpadKeyE: 0xc0,
NumpadKeyF: 0xc1,
NumpadLeftArrow: 0x5c,
NumpadLeftBrace: 0xb8,
NumpadLeftParen: 0xb6, NumpadLeftParen: 0xb6,
NumpadLessThan: 0xc5,
NumpadLogicalAnd: 0xc8,
NumpadLogicalOr: 0xca,
NumpadMemoryAdd: 0xd3,
NumpadMemoryClear: 0xd2,
NumpadMemoryDivide: 0xd6,
NumpadMemoryMultiply: 0xd5,
NumpadMemoryRecall: 0xd1,
NumpadMemoryStore: 0xd0,
NumpadMemorySubtract: 0xd4,
NumpadMultiply: 0x55, NumpadMultiply: 0x55,
NumpadOctal: 0xdb,
NumpadOctathorpe: 0xcc,
NumpadOr: 0xc9,
NumpadPageDown: 0x5b,
NumpadPageUp: 0x61,
NumpadPercent: 0xc4,
NumpadPlusMinus: 0xd7,
NumpadRightArrow: 0x5e,
NumpadRightBrace: 0xb9,
NumpadRightParen: 0xb7, NumpadRightParen: 0xb7,
NumpadSpace: 0xcd,
NumpadSubtract: 0x56, NumpadSubtract: 0x56,
NumpadTab: 0xba,
NumpadUpArrow: 0x60,
NumpadXOR: 0xc2,
Octothorpe: 0x32, // non-US # and ~
Operation: 0xa1,
Out: 0xa0,
PageDown: 0x4e, PageDown: 0x4e,
PageUp: 0x4b, PageUp: 0x4b,
Paste: 0x7d,
Pause: 0x48,
Period: 0x37, Period: 0x37,
Power: 0x66,
PrintScreen: 0x46, PrintScreen: 0x46,
Prior: 0x9d, Pause: 0x48,
Power: 0x66,
Quote: 0x34, // aka Single Quote or Apostrophe Quote: 0x34, // aka Single Quote or Apostrophe
Return: 0x9e,
ScrollLock: 0x47, ScrollLock: 0x47,
Select: 0x77,
Semicolon: 0x33, Semicolon: 0x33,
Separator: 0x9f,
ShiftLeft: 0xe1,
ShiftRight: 0xe5,
Slash: 0x38, Slash: 0x38,
Space: 0x2c, Space: 0x2c,
Stop: 0x78,
SystemRequest: 0x9a, SystemRequest: 0x9a,
Tab: 0x2b, Tab: 0x2b,
ThousandsSeparator: 0xb2, ControlLeft: 0xe0,
Tilde: 0x35, ControlRight: 0xe4,
Undo: 0x7a, ShiftLeft: 0xe1,
VolumeDown: 0x81, ShiftRight: 0xe5,
VolumeUp: 0x80, AltLeft: 0xe2,
AltRight: 0xe6,
MetaLeft: 0xe3,
MetaRight: 0xe7,
} as Record<string, number>; } as Record<string, number>;
export const deadKeys = {
0x005e: "Circumflex",
0x02c7: "Caron",
0x00b7: "Dot",
0x02d8: "Breve",
0x002c: "Comma",
0x00b0: "Kreis",
0x00b4: "Acute",
0x00a8: "Umlaut",
0x0060: "Grave",
0x007e: "Tilde",
0x02dd: "DoubleAcute",
0x02db: "Ogonek",
0x00b8: "Cedilla",
} as Record<number, string>
export const modifiers = { export const modifiers = {
ControlLeft: 0x01, ControlLeft: 0x01,
ControlRight: 0x10, ControlRight: 0x10,
@ -282,40 +161,37 @@ export const modifierDisplayMap: Record<string, string> = {
AltRight: "Right Alt", AltRight: "Right Alt",
MetaLeft: "Left Meta", MetaLeft: "Left Meta",
MetaRight: "Right Meta", MetaRight: "Right Meta",
AltGr: "AltGr",
} as Record<string, string>; } as Record<string, string>;
export const keyDisplayMap: Record<string, string> = { export const keyDisplayMap: Record<string, string> = {
CtrlAltDelete: "Ctrl + Alt + Delete",
AltMetaEscape: "Alt + Meta + Escape", AltMetaEscape: "Alt + Meta + Escape",
CtrlAltBackspace: "Ctrl + Alt + Backspace", CtrlAltBackspace: "Ctrl + Alt + Backspace",
CtrlAltDelete: "Ctrl + Alt + Delete", Escape: "esc",
Tab: "tab",
AltGraph: "alt gr", Backspace: "backspace",
"(Backspace)": "backspace",
Enter: "enter",
CapsLock: "caps lock",
ShiftLeft: "shift",
ShiftRight: "shift",
ControlLeft: "ctrl",
AltLeft: "alt", AltLeft: "alt",
AltRight: "alt", AltRight: "alt",
ArrowDown: "↓", MetaLeft: "meta",
MetaRight: "meta",
Space: " ",
Insert: "insert",
Home: "home",
PageUp: "page up",
Delete: "delete",
End: "end",
PageDown: "page down",
ArrowLeft: "←", ArrowLeft: "←",
ArrowRight: "→", ArrowRight: "→",
ArrowUp: "↑", ArrowUp: "↑",
Backspace: "backspace", ArrowDown: "↓",
"(Backspace)": "backspace",
CapsLock: "caps lock",
ControlLeft: "ctrl",
Delete: "delete",
End: "end",
Enter: "enter",
Escape: "esc",
Home: "home",
Insert: "insert",
MetaLeft: "meta",
MetaRight: "meta",
PageDown: "page down",
PageUp: "page up",
ShiftLeft: "shift",
ShiftRight: "shift",
Space: " ",
Tab: "tab",
// Letters // Letters
KeyA: "a", KeyB: "b", KeyC: "c", KeyD: "d", KeyE: "e", KeyA: "a", KeyB: "b", KeyC: "c", KeyD: "d", KeyE: "e",
KeyF: "f", KeyG: "g", KeyH: "h", KeyI: "i", KeyJ: "j", KeyF: "f", KeyG: "g", KeyH: "h", KeyI: "i", KeyJ: "j",
@ -346,7 +222,7 @@ export const keyDisplayMap: Record<string, string> = {
Equal: "=", Equal: "=",
"(Equal)": "+", "(Equal)": "+",
BracketLeft: "[", BracketLeft: "[",
"(BracketLeft)": "{", "(BracketLeft)": "{",
BracketRight: "]", BracketRight: "]",
"(BracketRight)": "}", "(BracketRight)": "}",
Backslash: "\\", Backslash: "\\",