diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index 1292449b..90fec578 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -389,11 +389,11 @@ function createMainWindow() { removeSettingsListeners(); removeVencordSettingsListeners(); - const { staticTitle, transparencyOption, enableMenu, customTitleBar } = Settings.store; + const { staticTitle, transparencyOption, enableMenu, titleBar } = Settings.store; const { frameless, transparent } = VencordSettings.store; - const noFrame = frameless === true || customTitleBar === true; + const noFrame = frameless === true || titleBar === "hidden"; const win = (mainWin = new BrowserWindow({ show: false, @@ -419,18 +419,20 @@ function createMainWindow() { backgroundMaterial: transparencyOption }), // Fix transparencyOption for custom discord titlebar - ...(customTitleBar && + ...(titleBar === "custom" && transparencyOption && transparencyOption !== "none" && { transparent: true }), ...(staticTitle && { title: "Vesktop" }), - ...(process.platform === "darwin" && getDarwinOptions()), + ...(process.platform === "darwin" && titleBar !== "shown" && getDarwinOptions()), // Show/Hide titlebar depending on settings on Mac ...getWindowBoundsOptions(), autoHideMenuBar: enableMenu })); win.setMenuBarVisibility(false); - if (process.platform === "darwin" && customTitleBar) win.setWindowButtonVisibility(false); + if (process.platform === "darwin" && titleBar === "custom") { + win.setWindowButtonVisibility(false); // Hide the traffic lights + } win.on("close", e => { const useTray = !isDeckGameMode && Settings.store.minimizeToTray !== false && Settings.store.tray !== false; diff --git a/src/main/utils/popout.ts b/src/main/utils/popout.ts index cdeea619..57f7f438 100644 --- a/src/main/utils/popout.ts +++ b/src/main/utils/popout.ts @@ -37,7 +37,7 @@ const DEFAULT_POPOUT_OPTIONS: BrowserWindowConstructorOptions = { backgroundColor: "#2f3136", minWidth: MIN_POPOUT_WIDTH, minHeight: MIN_POPOUT_HEIGHT, - frame: Settings.store.customTitleBar !== true, + frame: Settings.store.titleBar !== "custom", titleBarStyle: process.platform === "darwin" ? "hidden" : undefined, trafficLightPosition: process.platform === "darwin" diff --git a/src/renderer/components/settings/Settings.tsx b/src/renderer/components/settings/Settings.tsx index d56f0ea4..4c8bafb4 100644 --- a/src/renderer/components/settings/Settings.tsx +++ b/src/renderer/components/settings/Settings.tsx @@ -14,6 +14,7 @@ import { isMac, isWindows } from "renderer/utils"; import { AutoStartToggle } from "./AutoStartToggle"; import { DiscordBranchPicker } from "./DiscordBranchPicker"; import { NotificationBadgeToggle } from "./NotificationBadgeToggle"; +import { TitleBarPicker } from "./TitleBarPicker"; import { VencordLocationPicker } from "./VencordLocationPicker"; import { WindowsTransparencyControls } from "./WindowsTransparencyControls"; @@ -39,13 +40,8 @@ const SettingsOptions: Record> defaultValue: true } ], - "User Interface": [ - { - key: "customTitleBar", - title: "Discord Titlebar", - description: "Use Discord's custom title bar instead of the native system one. Requires a full restart.", - defaultValue: isWindows - }, + "Title Bar": [ + TitleBarPicker, { key: "staticTitle", title: "Static Title", @@ -57,8 +53,11 @@ const SettingsOptions: Record> title: "Enable Menu Bar", description: "Enables the application menu bar. Press ALT to toggle visibility.", defaultValue: false, - disabled: () => Settings.store.customTitleBar ?? isWindows - }, + invisible: () => isMac, + disabled: () => Settings.store.titleBar === "custom" || isWindows + } + ], + "User Interface": [ { key: "splashTheming", title: "Splash theming", diff --git a/src/renderer/components/settings/TitleBarPicker.tsx b/src/renderer/components/settings/TitleBarPicker.tsx new file mode 100644 index 00000000..988b427d --- /dev/null +++ b/src/renderer/components/settings/TitleBarPicker.tsx @@ -0,0 +1,36 @@ +/* + * SPDX-License-Identifier: GPL-3.0 + * Vesktop, a desktop app aiming to give you a snappier Discord Experience + * Copyright (c) 2023 Vendicated and Vencord contributors + */ + +import { Margins } from "@vencord/types/utils"; +import { Forms, Select } from "@vencord/types/webpack/common"; +import { isMac, isWindows } from "renderer/utils"; + +import { SettingsComponent } from "./Settings"; + +export const TitleBarPicker: SettingsComponent = ({ settings }) => { + return ( + <> + + Customize apps title bar. Pick Discord if you want to use Discord's custom title bar. Requires a full + restart + + +