fix "Disable minimum window size" option (#3335)

Fixes #3330
Fixes #878
This commit is contained in:
iilwy 2025-04-14 06:41:50 -05:00 committed by GitHub
parent 1fa6181f7e
commit fe0309ffaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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");