disable background throttling; hopefully fix unloads when in background
This commit is contained in:
parent
6b948668b9
commit
b6c3c8024b
2 changed files with 10 additions and 7 deletions
|
@ -42,7 +42,13 @@ function init() {
|
||||||
|
|
||||||
// disable renderer backgrounding to prevent the app from unloading when in the background
|
// disable renderer backgrounding to prevent the app from unloading when in the background
|
||||||
// https://github.com/electron/electron/issues/2822
|
// https://github.com/electron/electron/issues/2822
|
||||||
|
// https://github.com/GoogleChrome/chrome-launcher/blob/5a27dd574d47a75fec0fb50f7b774ebf8a9791ba/docs/chrome-flags-for-tools.md#task-throttling
|
||||||
app.commandLine.appendSwitch("disable-renderer-backgrounding");
|
app.commandLine.appendSwitch("disable-renderer-backgrounding");
|
||||||
|
app.commandLine.appendSwitch("disable-background-timer-throttling");
|
||||||
|
app.commandLine.appendSwitch("disable-backgrounding-occluded-windows");
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
disabledFeatures.push("CalculateNativeWinOcclusion");
|
||||||
|
}
|
||||||
|
|
||||||
// work around chrome 66 disabling autoplay by default
|
// work around chrome 66 disabling autoplay by default
|
||||||
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
|
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
|
||||||
|
@ -50,12 +56,7 @@ function init() {
|
||||||
// HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service.
|
// HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service.
|
||||||
//
|
//
|
||||||
// WidgetLayering (Vencord Added): Fix DevTools context menus https://github.com/electron/electron/issues/38790
|
// WidgetLayering (Vencord Added): Fix DevTools context menus https://github.com/electron/electron/issues/38790
|
||||||
disabledFeatures.push(
|
disabledFeatures.push("WinRetrieveSuggestionsOnlyOnDemand", "HardwareMediaKeyHandling", "MediaSessionService");
|
||||||
"WinRetrieveSuggestionsOnlyOnDemand",
|
|
||||||
"HardwareMediaKeyHandling",
|
|
||||||
"MediaSessionService",
|
|
||||||
"WidgetLayering"
|
|
||||||
);
|
|
||||||
|
|
||||||
app.commandLine.appendSwitch("enable-features", [...new Set(enabledFeatures)].filter(Boolean).join(","));
|
app.commandLine.appendSwitch("enable-features", [...new Set(enabledFeatures)].filter(Boolean).join(","));
|
||||||
app.commandLine.appendSwitch("disable-features", [...new Set(disabledFeatures)].filter(Boolean).join(","));
|
app.commandLine.appendSwitch("disable-features", [...new Set(disabledFeatures)].filter(Boolean).join(","));
|
||||||
|
|
|
@ -403,7 +403,9 @@ function createMainWindow() {
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
devTools: true,
|
devTools: true,
|
||||||
preload: join(__dirname, "preload.js"),
|
preload: join(__dirname, "preload.js"),
|
||||||
spellcheck: true
|
spellcheck: true,
|
||||||
|
// disable renderer backgrounding to prevent the app from unloading when in the background
|
||||||
|
backgroundThrottling: false
|
||||||
},
|
},
|
||||||
icon: ICON_PATH,
|
icon: ICON_PATH,
|
||||||
frame: !noFrame,
|
frame: !noFrame,
|
||||||
|
|
Loading…
Reference in a new issue