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,8 +14,11 @@ import { handle } from "./utils/ipcWrappers";
let venbind: VenbindType | null = null; let venbind: VenbindType | null = null;
export function obtainVenbind() { export function obtainVenbind() {
if (venbind == null) {
// TODO?: make binary outputs consistant with node's apis // TODO?: make binary outputs consistant with node's apis
let os: string; let os: string;
let arch: string;
switch (process.platform) { switch (process.platform) {
case "linux": case "linux":
os = "linux"; os = "linux";
@ -26,8 +29,7 @@ export function obtainVenbind() {
// os = "darwin"; // os = "darwin";
default: default:
return null; return null;
}; }
let arch: string;
switch (process.arch) { switch (process.arch) {
case "x64": case "x64":
arch = "x86_64"; arch = "x86_64";
@ -37,8 +39,10 @@ export function obtainVenbind() {
// break; // break;
default: default:
return null; return null;
}; }
if (venbind == null) venbind = require(join(STATIC_DIR, `dist/venbind-${os}-${arch}.node`));
venbind = require(join(STATIC_DIR, `dist/venbind-${os}-${arch}.node`));
}
return venbind; return venbind;
} }

View file

@ -43,8 +43,8 @@ addPatch({
}, },
{ {
// eslint-disable-next-line no-useless-escape // eslint-disable-next-line no-useless-escape
match: /inputEventUnregister\((parseInt\(\i,10\))\);else if\(\i\[\i\]\)\{/, match: /inputEventUnregister\((parseInt\(\i,10\))\);else/,
replace: "$&$self.unregisterKeybind($1);return;" replace: "$&{$self.unregisterKeybind($1);return;}"
} }
] ]
} }