Add keyup/keydown support for the cli
TEMPORARY: show keybind ID in the keybind page
This commit is contained in:
parent
f08af9446f
commit
9748a036b6
3 changed files with 15 additions and 4 deletions
|
@ -63,7 +63,13 @@ function init() {
|
||||||
const keybindIndex = cmdLine.indexOf("--keybind");
|
const keybindIndex = cmdLine.indexOf("--keybind");
|
||||||
|
|
||||||
if (keybindIndex !== -1) {
|
if (keybindIndex !== -1) {
|
||||||
mainWin.webContents.executeJavaScript(`Vesktop.keybindCallbacks[${cmdLine[keybindIndex + 1]}](false)`);
|
if (cmdLine[keybindIndex + 2] === "keyup" || cmdLine[keybindIndex + 2] === "keydown") {
|
||||||
|
mainWin.webContents.executeJavaScript(
|
||||||
|
`Vesktop.keybindCallbacks[${cmdLine[keybindIndex + 1]}](${cmdLine[keybindIndex + 2] === "keydown" ? "true" : "false"})`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
mainWin.webContents.executeJavaScript(`Vesktop.keybindCallbacks[${cmdLine[keybindIndex + 1]}](false)`);
|
||||||
|
}
|
||||||
} else if (data.IS_DEV) app.quit();
|
} else if (data.IS_DEV) app.quit();
|
||||||
else if (mainWin) {
|
else if (mainWin) {
|
||||||
if (mainWin.isMinimized()) mainWin.restore();
|
if (mainWin.isMinimized()) mainWin.restore();
|
||||||
|
|
|
@ -134,7 +134,6 @@ const registered_keybinds = {};
|
||||||
|
|
||||||
handle(IpcEvents.KEYBIND_REGISTER, (_, id: number, shortcut: string, options: any) => {
|
handle(IpcEvents.KEYBIND_REGISTER, (_, id: number, shortcut: string, options: any) => {
|
||||||
registered_keybinds[id] = shortcut;
|
registered_keybinds[id] = shortcut;
|
||||||
console.log(registered_keybinds);
|
|
||||||
});
|
});
|
||||||
handle(IpcEvents.KEYBIND_UNREGISTER, (_, id: number) => {
|
handle(IpcEvents.KEYBIND_UNREGISTER, (_, id: number) => {
|
||||||
delete registered_keybinds[id];
|
delete registered_keybinds[id];
|
||||||
|
|
|
@ -22,8 +22,14 @@ addPatch({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// eslint-disable-next-line no-useless-escape
|
// eslint-disable-next-line no-useless-escape
|
||||||
match: /\(0,\i.isDesktop\)\(\)/g,
|
match: /\(0,\i\.isDesktop\)\(\)/g,
|
||||||
replace: "true"
|
replace: "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// THIS PATCH IS TEMPORARY
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
|
match: /\.keybindGroup,\i.card\),children:\[/g,
|
||||||
|
replace: "$&`ID: ${this.props.keybind.id}`,"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -37,7 +43,7 @@ addPatch({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// eslint-disable-next-line no-useless-escape
|
// eslint-disable-next-line no-useless-escape
|
||||||
match: /inputEventUnregister\((parseInt\(\i,10\))\);else\{/,
|
match: /inputEventUnregister\((parseInt\(\i,10\))\);else if\(\i\[\i\]\)\{/,
|
||||||
replace: "$&$self.unregisterKeybind($1);return;"
|
replace: "$&$self.unregisterKeybind($1);return;"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue