Add Ctrl+Q Exit shortcut on Windows

This commit is contained in:
Vendicated 2023-01-07 22:53:41 +01:00
parent 06aa72c636
commit 15aa2299c3
No known key found for this signature in database
GPG Key ID: A1DC0CFB5615D905

@ -17,7 +17,7 @@
*/ */
import { onceDefined } from "@utils/onceDefined"; import { onceDefined } from "@utils/onceDefined";
import electron, { app, BrowserWindowConstructorOptions } from "electron"; import electron, { app, BrowserWindowConstructorOptions, globalShortcut } from "electron";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { dirname, join } from "path"; import { dirname, join } from "path";
@ -153,6 +153,13 @@ if (!process.argv.includes("--vanilla")) {
responseHeaders["content-type"] = ["text/css"]; responseHeaders["content-type"] = ["text/css"];
} }
cb({ cancel: false, responseHeaders }); cb({ cancel: false, responseHeaders });
if (process.platform === "win32") {
globalShortcut.register("Control+Q", () => {
app.quit();
});
}
}); });
}); });
} else { } else {