mirror of https://github.com/jetkvm/kvm.git
feat(ui): Enhance Virtual Keyboard for US (#449)
* feat(ui): Add Ctrl+Alt-Backspace combination key to Virtual Keyboard Fixes #445 (somewhat) * fix(ui): Correct virtual keyboard display when shift key is down. Somewhere along the way, the handling of the shift-key state for letters and numbers was lost and we stopped displaying the capital/symbol for the key. Also update page up and page down to have the space in the on-screen key. * feat(ui): Add missing keys for virtual keyboard Enable insert, delete, numpad equal, print scree, scroll lock, pause, system request, break keys.
This commit is contained in:
parent
7ccb8e617c
commit
c9dd3cd926
|
@ -143,6 +143,16 @@ function KeyboardWrapper() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key === "CtrlAltBackspace") {
|
||||||
|
sendKeyboardEvent(
|
||||||
|
[keys["Backspace"]],
|
||||||
|
[modifiers["ControlLeft"], modifiers["AltLeft"]],
|
||||||
|
);
|
||||||
|
|
||||||
|
setTimeout(resetKeyboardState, 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isKeyShift || isKeyCaps) {
|
if (isKeyShift || isKeyCaps) {
|
||||||
toggleLayout();
|
toggleLayout();
|
||||||
|
|
||||||
|
@ -257,13 +267,13 @@ function KeyboardWrapper() {
|
||||||
buttonTheme={[
|
buttonTheme={[
|
||||||
{
|
{
|
||||||
class: "combination-key",
|
class: "combination-key",
|
||||||
buttons: "CtrlAltDelete AltMetaEscape",
|
buttons: "CtrlAltDelete AltMetaEscape CtrlAltBackspace",
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
display={keyDisplayMap}
|
display={keyDisplayMap}
|
||||||
layout={{
|
layout={{
|
||||||
default: [
|
default: [
|
||||||
"CtrlAltDelete AltMetaEscape",
|
"CtrlAltDelete AltMetaEscape CtrlAltBackspace",
|
||||||
"Escape F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12",
|
"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",
|
"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",
|
"Tab KeyQ KeyW KeyE KeyR KeyT KeyY KeyU KeyI KeyO KeyP BracketLeft BracketRight Backslash",
|
||||||
|
@ -272,7 +282,7 @@ function KeyboardWrapper() {
|
||||||
"ControlLeft AltLeft MetaLeft Space MetaRight AltRight",
|
"ControlLeft AltLeft MetaLeft Space MetaRight AltRight",
|
||||||
],
|
],
|
||||||
shift: [
|
shift: [
|
||||||
"CtrlAltDelete AltMetaEscape",
|
"CtrlAltDelete AltMetaEscape CtrlAltBackspace",
|
||||||
"Escape F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12",
|
"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)",
|
"(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)",
|
"Tab (KeyQ) (KeyW) (KeyE) (KeyR) (KeyT) (KeyY) (KeyU) (KeyI) (KeyO) (KeyP) (BracketLeft) (BracketRight) (Backslash)",
|
||||||
|
@ -282,7 +292,7 @@ function KeyboardWrapper() {
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
disableButtonHold={true}
|
disableButtonHold={true}
|
||||||
mergeDisplay={true}
|
syncInstanceInputs={true}
|
||||||
debug={false}
|
debug={false}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -290,34 +300,25 @@ function KeyboardWrapper() {
|
||||||
<Keyboard
|
<Keyboard
|
||||||
baseClass="simple-keyboard-control"
|
baseClass="simple-keyboard-control"
|
||||||
theme="simple-keyboard hg-theme-default hg-layout-default"
|
theme="simple-keyboard hg-theme-default hg-layout-default"
|
||||||
|
layoutName={layoutName}
|
||||||
|
onKeyPress={onKeyDown}
|
||||||
|
display={keyDisplayMap}
|
||||||
layout={{
|
layout={{
|
||||||
default: ["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"],
|
||||||
display={{
|
|
||||||
Home: "home",
|
|
||||||
Pageup: "pageup",
|
|
||||||
Delete: "delete",
|
|
||||||
End: "end",
|
|
||||||
Pagedown: "pagedown",
|
|
||||||
}}
|
}}
|
||||||
syncInstanceInputs={true}
|
syncInstanceInputs={true}
|
||||||
onKeyPress={onKeyDown}
|
|
||||||
mergeDisplay={true}
|
|
||||||
debug={false}
|
debug={false}
|
||||||
/>
|
/>
|
||||||
<Keyboard
|
<Keyboard
|
||||||
baseClass="simple-keyboard-arrows"
|
baseClass="simple-keyboard-arrows"
|
||||||
theme="simple-keyboard hg-theme-default hg-layout-default"
|
theme="simple-keyboard hg-theme-default hg-layout-default"
|
||||||
display={{
|
onKeyPress={onKeyDown}
|
||||||
ArrowLeft: "←",
|
display={keyDisplayMap}
|
||||||
ArrowRight: "→",
|
|
||||||
ArrowUp: "↑",
|
|
||||||
ArrowDown: "↓",
|
|
||||||
}}
|
|
||||||
layout={{
|
layout={{
|
||||||
default: ["ArrowUp", "ArrowLeft ArrowDown ArrowRight"],
|
default: ["ArrowUp", "ArrowLeft ArrowDown ArrowRight"],
|
||||||
}}
|
}}
|
||||||
onKeyPress={onKeyDown}
|
syncInstanceInputs={true}
|
||||||
debug={false}
|
debug={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -86,16 +86,21 @@ export const keys = {
|
||||||
NumpadAdd: 0x57,
|
NumpadAdd: 0x57,
|
||||||
NumpadDivide: 0x54,
|
NumpadDivide: 0x54,
|
||||||
NumpadEnter: 0x58,
|
NumpadEnter: 0x58,
|
||||||
|
NumpadEqual: 0x67,
|
||||||
NumpadMultiply: 0x55,
|
NumpadMultiply: 0x55,
|
||||||
NumpadSubtract: 0x56,
|
NumpadSubtract: 0x56,
|
||||||
NumpadDecimal: 0x63,
|
NumpadDecimal: 0x63,
|
||||||
PageDown: 0x4e,
|
PageDown: 0x4e,
|
||||||
PageUp: 0x4b,
|
PageUp: 0x4b,
|
||||||
Period: 0x37,
|
Period: 0x37,
|
||||||
|
PrintScreen: 0x46,
|
||||||
|
Pause: 0x48,
|
||||||
Quote: 0x34,
|
Quote: 0x34,
|
||||||
|
ScrollLock: 0x47,
|
||||||
Semicolon: 0x33,
|
Semicolon: 0x33,
|
||||||
Slash: 0x38,
|
Slash: 0x38,
|
||||||
Space: 0x2c,
|
Space: 0x2c,
|
||||||
|
SystemRequest: 0x9a,
|
||||||
Tab: 0x2b,
|
Tab: 0x2b,
|
||||||
} as Record<string, number>;
|
} as Record<string, number>;
|
||||||
|
|
||||||
|
@ -200,6 +205,13 @@ export const chars = {
|
||||||
"\n": { key: "Enter", shift: false },
|
"\n": { key: "Enter", shift: false },
|
||||||
Enter: { key: "Enter", shift: false },
|
Enter: { key: "Enter", shift: false },
|
||||||
Tab: { key: "Tab", shift: false },
|
Tab: { key: "Tab", shift: false },
|
||||||
|
PrintScreen: { key: "Prt Sc", shift: false },
|
||||||
|
SystemRequest: { key: "Prt Sc", shift: true },
|
||||||
|
ScrollLock: { key: "ScrollLock", shift: false},
|
||||||
|
Pause: { key: "Pause", shift: false },
|
||||||
|
Break: { key: "Pause", shift: true },
|
||||||
|
Insert: { key: "Insert", shift: false },
|
||||||
|
Delete: { key: "Delete", shift: false },
|
||||||
} as Record<string, { key: string | number; shift: boolean }>;
|
} as Record<string, { key: string | number; shift: boolean }>;
|
||||||
|
|
||||||
export const modifiers = {
|
export const modifiers = {
|
||||||
|
@ -227,6 +239,7 @@ export const modifierDisplayMap: Record<string, string> = {
|
||||||
export const keyDisplayMap: Record<string, string> = {
|
export const keyDisplayMap: Record<string, string> = {
|
||||||
CtrlAltDelete: "Ctrl + Alt + Delete",
|
CtrlAltDelete: "Ctrl + Alt + Delete",
|
||||||
AltMetaEscape: "Alt + Meta + Escape",
|
AltMetaEscape: "Alt + Meta + Escape",
|
||||||
|
CtrlAltBackspace: "Ctrl + Alt + Backspace",
|
||||||
Escape: "esc",
|
Escape: "esc",
|
||||||
Tab: "tab",
|
Tab: "tab",
|
||||||
Backspace: "backspace",
|
Backspace: "backspace",
|
||||||
|
@ -240,11 +253,12 @@ export const keyDisplayMap: Record<string, string> = {
|
||||||
MetaLeft: "meta",
|
MetaLeft: "meta",
|
||||||
MetaRight: "meta",
|
MetaRight: "meta",
|
||||||
Space: " ",
|
Space: " ",
|
||||||
|
Insert: "insert",
|
||||||
Home: "home",
|
Home: "home",
|
||||||
PageUp: "pageup",
|
PageUp: "page up",
|
||||||
Delete: "delete",
|
Delete: "delete",
|
||||||
End: "end",
|
End: "end",
|
||||||
PageDown: "pagedown",
|
PageDown: "page down",
|
||||||
ArrowLeft: "←",
|
ArrowLeft: "←",
|
||||||
ArrowRight: "→",
|
ArrowRight: "→",
|
||||||
ArrowUp: "↑",
|
ArrowUp: "↑",
|
||||||
|
@ -258,22 +272,45 @@ export const keyDisplayMap: Record<string, string> = {
|
||||||
KeyU: "u", KeyV: "v", KeyW: "w", KeyX: "x", KeyY: "y",
|
KeyU: "u", KeyV: "v", KeyW: "w", KeyX: "x", KeyY: "y",
|
||||||
KeyZ: "z",
|
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
|
// Numbers
|
||||||
Digit1: "1", Digit2: "2", Digit3: "3", Digit4: "4", Digit5: "5",
|
Digit1: "1", Digit2: "2", Digit3: "3", Digit4: "4", Digit5: "5",
|
||||||
Digit6: "6", Digit7: "7", Digit8: "8", Digit9: "9", Digit0: "0",
|
Digit6: "6", Digit7: "7", Digit8: "8", Digit9: "9", Digit0: "0",
|
||||||
|
|
||||||
|
// Shifted Numbers
|
||||||
|
"(Digit1)": "!", "(Digit2)": "@", "(Digit3)": "#", "(Digit4)": "$", "(Digit5)": "%",
|
||||||
|
"(Digit6)": "^", "(Digit7)": "&", "(Digit8)": "*", "(Digit9)": "(", "(Digit0)": ")",
|
||||||
|
|
||||||
// Symbols
|
// Symbols
|
||||||
Minus: "-",
|
Minus: "-",
|
||||||
|
"(Minus)": "_",
|
||||||
Equal: "=",
|
Equal: "=",
|
||||||
|
"(Equal)": "+",
|
||||||
BracketLeft: "[",
|
BracketLeft: "[",
|
||||||
|
"(BracketLeft)": "{",
|
||||||
BracketRight: "]",
|
BracketRight: "]",
|
||||||
|
"(BracketRight)": "}",
|
||||||
Backslash: "\\",
|
Backslash: "\\",
|
||||||
|
"(Backslash)": "|",
|
||||||
Semicolon: ";",
|
Semicolon: ";",
|
||||||
|
"(Semicolon)": ":",
|
||||||
Quote: "'",
|
Quote: "'",
|
||||||
|
"(Quote)": "\"",
|
||||||
Comma: ",",
|
Comma: ",",
|
||||||
|
"(Comma)": "<",
|
||||||
Period: ".",
|
Period: ".",
|
||||||
|
"(Period)": ">",
|
||||||
Slash: "/",
|
Slash: "/",
|
||||||
|
"(Slash)": "?",
|
||||||
Backquote: "`",
|
Backquote: "`",
|
||||||
|
"(Backquote)": "~",
|
||||||
IntlBackslash: "\\",
|
IntlBackslash: "\\",
|
||||||
|
|
||||||
// Function keys
|
// Function keys
|
||||||
|
@ -287,5 +324,11 @@ export const keyDisplayMap: Record<string, string> = {
|
||||||
Numpad6: "Num 6", Numpad7: "Num 7", Numpad8: "Num 8",
|
Numpad6: "Num 6", Numpad7: "Num 7", Numpad8: "Num 8",
|
||||||
Numpad9: "Num 9", NumpadAdd: "Num +", NumpadSubtract: "Num -",
|
Numpad9: "Num 9", NumpadAdd: "Num +", NumpadSubtract: "Num -",
|
||||||
NumpadMultiply: "Num *", NumpadDivide: "Num /", NumpadDecimal: "Num .",
|
NumpadMultiply: "Num *", NumpadDivide: "Num /", NumpadDecimal: "Num .",
|
||||||
NumpadEnter: "Num Enter"
|
NumpadEqual: "Num =", NumpadEnter: "Num Enter",
|
||||||
|
NumLock: "Num Lock",
|
||||||
|
|
||||||
|
// Modals
|
||||||
|
PrintScreen: "prt sc", ScrollLock: "scr lk", Pause: "pause",
|
||||||
|
"(PrintScreen)": "sys rq", "(Pause)": "break",
|
||||||
|
SystemRequest: "sys rq", Break: "break"
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue