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;}" } ] }