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; let venbind: VenbindType | null = null;
export function obtainVenbind() { export function obtainVenbind() {
// TODO?: make binary outputs consistant with node's apis if (venbind == null) {
let os: string; // TODO?: make binary outputs consistant with node's apis
switch (process.platform) { let os: string;
case "linux": let arch: string;
os = "linux";
break; switch (process.platform) {
// case "win32": case "linux":
// os = "windows"; os = "linux";
// case "darwin": break;
// os = "darwin"; // case "win32":
default: // os = "windows";
return null; // case "darwin":
}; // os = "darwin";
let arch: string; default:
switch (process.arch) { return null;
case "x64": }
arch = "x86_64"; switch (process.arch) {
break; case "x64":
// case "arm64": arch = "x86_64";
// arch = "aarch64"; break;
// break; // case "arm64":
default: // arch = "aarch64";
return null; // break;
}; default:
if (venbind == null) venbind = require(join(STATIC_DIR, `dist/venbind-${os}-${arch}.node`)); return null;
}
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;}"
} }
] ]
} }