From 3c611121a8e077e55478b9c55b51221f25207a9d Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Wed, 25 Oct 2023 00:56:08 +0300 Subject: web: option to remap ctrl/caps --- web/share/css/navbar.css | 4 ++++ web/share/js/kvm/keyboard.js | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'web/share') diff --git a/web/share/css/navbar.css b/web/share/css/navbar.css index afee8f02..00249647 100644 --- a/web/share/css/navbar.css +++ b/web/share/css/navbar.css @@ -150,6 +150,10 @@ ul#navbar li div.menu details div.spoiler { border-left: var(--border-default-thin); border-bottom: var(--border-default-thin); } +ul#navbar li div.menu details div.spoiler hr { + border: none; + border-top: var(--border-default-thin); +} ul#navbar li div.menu details summary::marker { color: var(--cs-marker-fg); } diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js index b398e769..686d968b 100644 --- a/web/share/js/kvm/keyboard.js +++ b/web/share/js/kvm/keyboard.js @@ -51,6 +51,8 @@ export function Keyboard(__recordWsEvent) { window.addEventListener("focusin", __updateOnlineLeds); window.addEventListener("focusout", __updateOnlineLeds); + + tools.storage.bindSimpleSwitch($("hid-keyboard-swap-cc-switch"), "hid.keyboard.swap_cc", false); }; /************************************************************************/ @@ -129,6 +131,13 @@ export function Keyboard(__recordWsEvent) { var __sendKey = function(code, state) { tools.debug("Keyboard: key", (state ? "pressed:" : "released:"), code); + if ($("hid-keyboard-swap-cc-switch").checked) { + if (code === "ControlLeft") { + code = "CapsLock"; + } else if (code === "CapsLock") { + code = "ControlLeft"; + } + } let event = { "event_type": "key", "event": {"key": code, "state": state}, -- cgit v1.2.3