Skip to content

Commit

Permalink
fix turnary soup in main window options (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 authored Oct 24, 2023
1 parent e6dc026 commit 46a2314
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
.env
.DS_Store
.idea/
.pnpm-store/
57 changes: 32 additions & 25 deletions src/main/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,28 @@ function getWindowBoundsOptions(): BrowserWindowConstructorOptions {
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) {
const saveState = () => {
Settings.store.maximized = win.isMaximized();
Expand Down Expand Up @@ -342,10 +364,9 @@ function createMainWindow() {
removeSettingsListeners();
removeVencordSettingsListeners();

const { staticTitle, transparencyOption, splashTheming, splashBackground, enableMenu, discordWindowsTitleBar } =
Settings.store;
const { staticTitle, transparencyOption, enableMenu, discordWindowsTitleBar } = Settings.store;

const { frameless, macosTranslucency } = VencordSettings.store;
const { frameless } = VencordSettings.store;

const noFrame = frameless === true || (process.platform === "win32" && discordWindowsTitleBar === true);

Expand All @@ -361,28 +382,14 @@ function createMainWindow() {
},
icon: ICON_PATH,
frame: !noFrame,
...(transparencyOption && transparencyOption !== "none"
? {
backgroundColor: "#00000000",
backgroundMaterial: transparencyOption,
transparent: true
}
: {}),
...(staticTitle ? { title: "Vesktop" } : {}),
...(macosTranslucency
? {
vibrancy: "sidebar",
backgroundColor: "#ffffff00"
}
: {
backgroundColor: splashTheming
? splashBackground
: nativeTheme.shouldUseDarkColors
? "#313338"
: "#ffffff",
transparent: false
}),
...(process.platform === "darwin" ? { titleBarStyle: "hiddenInset" } : {}),
...(transparencyOption &&
transparencyOption !== "none" && {
backgroundColor: "#00000000",
backgroundMaterial: transparencyOption,
transparent: true
}),
...(staticTitle && { title: "Vesktop" }),
...(process.platform === "darwin" && getDarwinOptions()),
...getWindowBoundsOptions(),
autoHideMenuBar: enableMenu
}));
Expand Down

0 comments on commit 46a2314

Please sign in to comment.