From 3f3f9677ca5bff347bc5625b7762111102c76d7e Mon Sep 17 00:00:00 2001 From: nin0dev Date: Sat, 17 Feb 2024 05:55:43 -0500 Subject: [PATCH] Added main modifier key changing --- src/plugins/webKeybinds.web/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/webKeybinds.web/index.ts b/src/plugins/webKeybinds.web/index.ts index 554f726d5..ed08aa3aa 100644 --- a/src/plugins/webKeybinds.web/index.ts +++ b/src/plugins/webKeybinds.web/index.ts @@ -337,9 +337,20 @@ export default definePlugin({ enabledByDefault: true, onKey(e: KeyboardEvent) { - const hasCtrl = e.ctrlKey || (e.metaKey && navigator.platform.includes("Mac")); + let hasModifierKey; + switch (settings.store.mainModifierKey) { + case "ctrl": + hasModifierKey = e.ctrlKey || (e.metaKey && navigator.platform.includes("Mac")); + break; + case "shift": + hasModifierKey = e.shiftKey; + break; + case "alt": + hasModifierKey = e.altKey; + break; + } - if (hasCtrl) switch (e.key) { + if (hasModifierKey) switch (e.key) { case "t": case "T": e.preventDefault();