From 775877281ee2f0f439c45a6c0996f52327818754 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 23 May 2024 06:02:57 -0300 Subject: [PATCH] Revert removal of DevTools context menu fix --- src/main/patcher.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/patcher.ts b/src/main/patcher.ts index a85702a2..f0e3c3ab 100644 --- a/src/main/patcher.ts +++ b/src/main/patcher.ts @@ -131,7 +131,16 @@ if (!IS_VANILLA) { process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord"); - // work around discord unloading when in background + // 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");