From e818905520b3e14d50ece546cfaf48f85d2719e7 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:13:57 -0300 Subject: [PATCH] Workaround https://github.com/electron/electron/issues/43367 --- src/main/patcher.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/patcher.ts b/src/main/patcher.ts index e5b87290d..e858f3fcd 100644 --- a/src/main/patcher.ts +++ b/src/main/patcher.ts @@ -17,7 +17,7 @@ */ import { onceDefined } from "@shared/onceDefined"; -import electron, { app, BrowserWindowConstructorOptions, Menu } from "electron"; +import electron, { app, BrowserWindowConstructorOptions, Menu, nativeTheme } from "electron"; import { dirname, join } from "path"; import { initIpc } from "./ipcMain"; @@ -100,6 +100,19 @@ if (!IS_VANILLA) { super(options); initIpc(this); + + // Workaround for https://github.com/electron/electron/issues/43367. Vesktop also has its own workaround + // @TODO: Remove this when the issue is fixed + if (IS_DISCORD_DESKTOP) { + this.webContents.on("devtools-opened", () => { + if (!nativeTheme.shouldUseDarkColors) return; + + nativeTheme.themeSource = "light"; + setTimeout(() => { + nativeTheme.themeSource = "dark"; + }, 100); + }); + } } else super(options); } }