From fe0309ffaa88fc7b47fb58885bf0b3415656ac8a Mon Sep 17 00:00:00 2001 From: iilwy Date: Mon, 14 Apr 2025 06:41:50 -0500 Subject: [PATCH] fix "Disable minimum window size" option (#3335) Fixes #3330 Fixes #878 --- src/main/patcher.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/patcher.ts b/src/main/patcher.ts index e5b87290d..60b169af6 100644 --- a/src/main/patcher.ts +++ b/src/main/patcher.ts @@ -87,6 +87,11 @@ if (!IS_VANILLA) { options.backgroundColor = "#00000000"; } + if (settings.disableMinSize) { + options.minWidth = 0; + options.minHeight = 0; + } + const needsVibrancy = process.platform === "darwin" && settings.macosVibrancyStyle; if (needsVibrancy) { @@ -99,6 +104,12 @@ if (!IS_VANILLA) { process.env.DISCORD_PRELOAD = original; super(options); + + if (settings.disableMinSize) { + // Disable the Electron call entirely so that Discord can't dynamically change the size + this.setMinimumSize = (width: number, height: number) => { }; + } + initIpc(this); } else super(options); } @@ -117,16 +128,9 @@ if (!IS_VANILLA) { BrowserWindow }; - // Patch appSettings to force enable devtools and optionally disable min size + // Patch appSettings to force enable devtools onceDefined(global, "appSettings", s => { s.set("DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING", true); - if (settings.disableMinSize) { - s.set("MIN_WIDTH", 0); - s.set("MIN_HEIGHT", 0); - } else { - s.set("MIN_WIDTH", 940); - s.set("MIN_HEIGHT", 500); - } }); process.env.DATA_DIR = join(app.getPath("userData"), "..", "Vencord");