armcord/src/shortcuts.ts

19 lines
737 B
TypeScript
Raw Normal View History

2022-03-04 17:53:18 +00:00
import {app} from "electron";
import {mainWindow} from "./window";
2022-01-30 19:48:32 +00:00
//https://github.com/electron/electron/issues/1334#issuecomment-716080005
// TO-DO add more
app.on("web-contents-created", (webContentsCreatedEvent, webContents) => {
2022-03-04 17:53:18 +00:00
webContents.on("before-input-event", (beforeInputEvent, input) => {
// console.log('Main console::', input)
const {code, alt, control, shift, meta} = input;
// Shortcut: toggle devTools
if (shift && control && !alt && !meta && code === "KeyI") {
mainWindow.webContents.toggleDevTools();
}
// Shortcut: window reload
if (shift && control && !alt && !meta && code === "KeyR") {
mainWindow.reload();
}
});
2022-01-30 19:48:32 +00:00
});