Skip to content

Commit 4ec01d0

Browse files
committed
disable UseEcoQoSForBackgroundProcess
1 parent 6597061 commit 4ec01d0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/main/patcher.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,16 @@ if (!IS_VANILLA) {
131131

132132
process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord");
133133

134-
// Monkey patch commandLine to disable WidgetLayering: Fix DevTools context menus https://github.com/electron/electron/issues/38790
134+
// Monkey patch commandLine to:
135+
// - disable WidgetLayering: Fix DevTools context menus https://github.com/electron/electron/issues/38790
136+
// - disable UseEcoQoSForBackgroundProcess: Work around Discord unloading when in background
135137
const originalAppend = app.commandLine.appendSwitch;
136138
app.commandLine.appendSwitch = function (...args) {
137-
if (args[0] === "disable-features" && !args[1]?.includes("WidgetLayering")) {
138-
args[1] += ",WidgetLayering";
139+
if (args[0] === "disable-features") {
140+
const disabledFeatures = new Set((args[1] ?? "").split(","));
141+
disabledFeatures.add("WidgetLayering");
142+
disabledFeatures.add("UseEcoQoSForBackgroundProcess");
143+
args[1] += [...disabledFeatures].join(",");
139144
}
140145
return originalAppend.apply(this, args);
141146
};

0 commit comments

Comments
 (0)