aboutsummaryrefslogtreecommitdiff
path: root/src/patcher.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/patcher.ts')
-rw-r--r--src/patcher.ts42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/patcher.ts b/src/patcher.ts
index 82fc233..2da404f 100644
--- a/src/patcher.ts
+++ b/src/patcher.ts
@@ -43,33 +43,35 @@ require.main!.filename = join(asarPath, discordPkg.main);
app.setAppPath(asarPath);
if (!process.argv.includes("--vanilla")) {
+ let settings: typeof import("@api/settings").Settings = {} as any;
+ try {
+ settings = JSON.parse(readSettings());
+ } catch { }
+
// Repatch after host updates on Windows
if (process.platform === "win32") {
require("./patchWin32Updater");
- const originalBuild = Menu.buildFromTemplate;
- Menu.buildFromTemplate = function (template) {
- if (template[0]?.label === "&File") {
- const { submenu } = template[0];
- if (Array.isArray(submenu)) {
- submenu.push({
- label: "Quit (Hidden)",
- visible: false,
- acceleratorWorksWhenHidden: true,
- accelerator: "Control+Q",
- click: () => app.quit()
- });
+ if (settings.winCtrlQ) {
+ const originalBuild = Menu.buildFromTemplate;
+ Menu.buildFromTemplate = function (template) {
+ if (template[0]?.label === "&File") {
+ const { submenu } = template[0];
+ if (Array.isArray(submenu)) {
+ submenu.push({
+ label: "Quit (Hidden)",
+ visible: false,
+ acceleratorWorksWhenHidden: true,
+ accelerator: "Control+Q",
+ click: () => app.quit()
+ });
+ }
}
- }
- return originalBuild.call(this, template);
- };
+ return originalBuild.call(this, template);
+ };
+ }
}
- let settings = {} as any;
- try {
- settings = JSON.parse(readSettings());
- } catch { }
-
class BrowserWindow extends electron.BrowserWindow {
constructor(options: BrowserWindowConstructorOptions) {
if (options?.webPreferences?.preload && options.title) {