Custom keybind commands (#574)

* added custom keybindings

* removed logs
This commit is contained in:
Cole Lashley 2024-04-16 12:46:27 -07:00 committed by GitHub
parent d923de412a
commit bf447c60ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {