From 76d56583b7f914565eaff90a55767d8228c90b16 Mon Sep 17 00:00:00 2001 From: Tuxinal <24763016+tuxinal@users.noreply.github.com> Date: Sun, 18 Aug 2024 20:33:19 +0330 Subject: [PATCH] fix unregistering not working --- src/main/venbind.ts | 54 +++++++++++++++++--------------- src/renderer/patches/keybinds.ts | 4 +-- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/main/venbind.ts b/src/main/venbind.ts index 617b27e..5a075f1 100644 --- a/src/main/venbind.ts +++ b/src/main/venbind.ts @@ -14,31 +14,35 @@ import { handle } from "./utils/ipcWrappers"; let venbind: VenbindType | null = null; export function obtainVenbind() { - // TODO?: make binary outputs consistant with node's apis - let os: string; - switch (process.platform) { - case "linux": - os = "linux"; - break; - // case "win32": - // os = "windows"; - // case "darwin": - // os = "darwin"; - default: - return null; - }; - let arch: string; - switch (process.arch) { - case "x64": - arch = "x86_64"; - break; - // case "arm64": - // arch = "aarch64"; - // break; - default: - return null; - }; - if (venbind == null) venbind = require(join(STATIC_DIR, `dist/venbind-${os}-${arch}.node`)); + if (venbind == null) { + // TODO?: make binary outputs consistant with node's apis + let os: string; + let arch: string; + + switch (process.platform) { + case "linux": + os = "linux"; + break; + // case "win32": + // os = "windows"; + // case "darwin": + // os = "darwin"; + default: + return null; + } + switch (process.arch) { + case "x64": + arch = "x86_64"; + break; + // case "arm64": + // arch = "aarch64"; + // break; + default: + return null; + } + + venbind = require(join(STATIC_DIR, `dist/venbind-${os}-${arch}.node`)); + } return venbind; } diff --git a/src/renderer/patches/keybinds.ts b/src/renderer/patches/keybinds.ts index fc33f73..b8550c5 100644 --- a/src/renderer/patches/keybinds.ts +++ b/src/renderer/patches/keybinds.ts @@ -43,8 +43,8 @@ addPatch({ }, { // eslint-disable-next-line no-useless-escape - match: /inputEventUnregister\((parseInt\(\i,10\))\);else if\(\i\[\i\]\)\{/, - replace: "$&$self.unregisterKeybind($1);return;" + match: /inputEventUnregister\((parseInt\(\i,10\))\);else/, + replace: "$&{$self.unregisterKeybind($1);return;}" } ] }