fix turnary soup in main window options (#164)

This commit is contained in:
AAGaming 2023-10-24 18:24:37 -04:00 committed by GitHub
parent e6dc026708
commit 46a2314173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 25 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ node_modules
.env .env
.DS_Store .DS_Store
.idea/ .idea/
.pnpm-store/

View file

@ -278,6 +278,28 @@ function getWindowBoundsOptions(): BrowserWindowConstructorOptions {
return options; return options;
} }
function getDarwinOptions(): BrowserWindowConstructorOptions {
const options = {
titleBarStyle: "hiddenInset"
} as BrowserWindowConstructorOptions;
const { splashTheming, splashBackground } = Settings.store;
const { macosTranslucency } = VencordSettings.store;
if (macosTranslucency) {
options.vibrancy = "sidebar";
options.backgroundColor = "#ffffff00";
} else {
if (splashTheming) {
options.backgroundColor = splashBackground;
} else {
options.backgroundColor = nativeTheme.shouldUseDarkColors ? "#313338" : "#ffffff";
}
}
return options;
}
function initWindowBoundsListeners(win: BrowserWindow) { function initWindowBoundsListeners(win: BrowserWindow) {
const saveState = () => { const saveState = () => {
Settings.store.maximized = win.isMaximized(); Settings.store.maximized = win.isMaximized();
@ -342,10 +364,9 @@ function createMainWindow() {
removeSettingsListeners(); removeSettingsListeners();
removeVencordSettingsListeners(); removeVencordSettingsListeners();
const { staticTitle, transparencyOption, splashTheming, splashBackground, enableMenu, discordWindowsTitleBar } = const { staticTitle, transparencyOption, enableMenu, discordWindowsTitleBar } = Settings.store;
Settings.store;
const { frameless, macosTranslucency } = VencordSettings.store; const { frameless } = VencordSettings.store;
const noFrame = frameless === true || (process.platform === "win32" && discordWindowsTitleBar === true); const noFrame = frameless === true || (process.platform === "win32" && discordWindowsTitleBar === true);
@ -361,28 +382,14 @@ function createMainWindow() {
}, },
icon: ICON_PATH, icon: ICON_PATH,
frame: !noFrame, frame: !noFrame,
...(transparencyOption && transparencyOption !== "none" ...(transparencyOption &&
? { transparencyOption !== "none" && {
backgroundColor: "#00000000", backgroundColor: "#00000000",
backgroundMaterial: transparencyOption, backgroundMaterial: transparencyOption,
transparent: true transparent: true
} }),
: {}), ...(staticTitle && { title: "Vesktop" }),
...(staticTitle ? { title: "Vesktop" } : {}), ...(process.platform === "darwin" && getDarwinOptions()),
...(macosTranslucency
? {
vibrancy: "sidebar",
backgroundColor: "#ffffff00"
}
: {
backgroundColor: splashTheming
? splashBackground
: nativeTheme.shouldUseDarkColors
? "#313338"
: "#ffffff",
transparent: false
}),
...(process.platform === "darwin" ? { titleBarStyle: "hiddenInset" } : {}),
...getWindowBoundsOptions(), ...getWindowBoundsOptions(),
autoHideMenuBar: enableMenu autoHideMenuBar: enableMenu
})); }));