summaryrefslogtreecommitdiff
path: root/web/share/js
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-10-25 00:56:08 +0300
committerMaxim Devaev <[email protected]>2023-10-25 00:56:08 +0300
commit3c611121a8e077e55478b9c55b51221f25207a9d (patch)
tree4c7352556d583bd8881e2b4dac31cfdc0e6ef886 /web/share/js
parent620b9fcc890e6ffd1016847d9ab9313aa3ce063c (diff)
web: option to remap ctrl/caps
Diffstat (limited to 'web/share/js')
-rw-r--r--web/share/js/kvm/keyboard.js9
1 files changed, 9 insertions, 0 deletions
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},