From bf447c60ce2ee5ca980d1ae5b4ee188241a2eda0 Mon Sep 17 00:00:00 2001 From: Cole Lashley Date: Tue, 16 Apr 2024 12:46:27 -0700 Subject: [PATCH] Custom keybind commands (#574) * added custom keybindings * removed logs --- src/util/keyutil.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/util/keyutil.ts b/src/util/keyutil.ts index 16752f44..e9f28503 100644 --- a/src/util/keyutil.ts +++ b/src/util/keyutil.ts @@ -117,6 +117,10 @@ class KeybindManager { curKeybind.info = this.keyDescriptionsMap.get(curKeybind.command).info; } newKeyDescriptions.set(curKeybind.command, curKeybind); + + if (this.isCustomCommand(curKeybind.command)) { + this.registerKeybinding("app", "custom", curKeybind.command, null); + } } } catch (e) { let userError = `${curUserCommand} is invalid: error: ${e}`; @@ -129,6 +133,14 @@ class KeybindManager { this.keyDescriptionsMap = newKeyDescriptions; } + isCustomCommand(keyDescription: string): boolean { + let words = keyDescription.split(":"); + if (words.length >= 2 && words[0] == "custom") { + return true; + } + return false; + } + prettyPrintKeyPress(keyPress: KeyPressDecl): string { let returnString = ""; if (keyPress.mods.Cmd) {