From a0778f6a2e786889d11f2b627f2ac03f7696c2e5 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 23 May 2024 03:35:02 +0200 Subject: [PATCH] work around discord unloading in background --- src/main/patcher.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/patcher.ts b/src/main/patcher.ts index 0d79a96f6..a85702a27 100644 --- a/src/main/patcher.ts +++ b/src/main/patcher.ts @@ -73,6 +73,9 @@ if (!IS_VANILLA) { const original = options.webPreferences.preload; options.webPreferences.preload = join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js"); options.webPreferences.sandbox = false; + // work around discord unloading when in background + options.webPreferences.backgroundThrottling = false; + if (settings.frameless) { options.frame = false; } else if (process.platform === "win32" && settings.winNativeTitleBar) { @@ -128,14 +131,8 @@ if (!IS_VANILLA) { process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord"); - // Monkey patch commandLine to disable WidgetLayering: Fix DevTools context menus https://github.com/electron/electron/issues/38790 - const originalAppend = app.commandLine.appendSwitch; - app.commandLine.appendSwitch = function (...args) { - if (args[0] === "disable-features" && !args[1]?.includes("WidgetLayering")) { - args[1] += ",WidgetLayering"; - } - return originalAppend.apply(this, args); - }; + // work around discord unloading when in background + app.commandLine.appendSwitch("disable-renderer-backgrounding"); } else { console.log("[Vencord] Running in vanilla mode. Not loading Vencord"); }