fix unregistering not working

This commit is contained in:
Tuxinal 2024-08-18 20:33:19 +03:30
parent 2fcf255f92
commit 76d56583b7
2 changed files with 31 additions and 27 deletions

View file

@ -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;
}

View file

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