diff --git a/src/main/index.ts b/src/main/index.ts index bfca49a..2569d40 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -63,7 +63,13 @@ function init() { const keybindIndex = cmdLine.indexOf("--keybind"); if (keybindIndex !== -1) { - mainWin.webContents.executeJavaScript(`Vesktop.keybindCallbacks[${cmdLine[keybindIndex + 1]}](false)`); + if (cmdLine[keybindIndex + 2] === "keyup" || cmdLine[keybindIndex + 2] === "keydown") { + mainWin.webContents.executeJavaScript( + `Vesktop.keybindCallbacks[${cmdLine[keybindIndex + 1]}](${cmdLine[keybindIndex + 2] === "keydown" ? "true" : "false"})` + ); + } else { + mainWin.webContents.executeJavaScript(`Vesktop.keybindCallbacks[${cmdLine[keybindIndex + 1]}](false)`); + } } else if (data.IS_DEV) app.quit(); else if (mainWin) { if (mainWin.isMinimized()) mainWin.restore(); diff --git a/src/main/ipc.ts b/src/main/ipc.ts index fb6dd44..4166c6d 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -134,7 +134,6 @@ const registered_keybinds = {}; handle(IpcEvents.KEYBIND_REGISTER, (_, id: number, shortcut: string, options: any) => { registered_keybinds[id] = shortcut; - console.log(registered_keybinds); }); handle(IpcEvents.KEYBIND_UNREGISTER, (_, id: number) => { delete registered_keybinds[id]; diff --git a/src/renderer/patches/keybinds.ts b/src/renderer/patches/keybinds.ts index 717113b..6ba1f90 100644 --- a/src/renderer/patches/keybinds.ts +++ b/src/renderer/patches/keybinds.ts @@ -22,8 +22,14 @@ addPatch({ }, { // eslint-disable-next-line no-useless-escape - match: /\(0,\i.isDesktop\)\(\)/g, + match: /\(0,\i\.isDesktop\)\(\)/g, replace: "true" + }, + { + // THIS PATCH IS TEMPORARY + // eslint-disable-next-line no-useless-escape + match: /\.keybindGroup,\i.card\),children:\[/g, + replace: "$&`ID: ${this.props.keybind.id}`," } ] }, @@ -37,7 +43,7 @@ addPatch({ }, { // eslint-disable-next-line no-useless-escape - match: /inputEventUnregister\((parseInt\(\i,10\))\);else\{/, + match: /inputEventUnregister\((parseInt\(\i,10\))\);else if\(\i\[\i\]\)\{/, replace: "$&$self.unregisterKeybind($1);return;" } ]