Merge 6f75c8665e into d008f90399
				
					
				
			This commit is contained in:
		
						commit
						7ebf09696c
					
				
					 7 changed files with 55 additions and 18 deletions
				
			
		|  | @ -389,11 +389,11 @@ function createMainWindow() { | ||||||
|     removeSettingsListeners(); |     removeSettingsListeners(); | ||||||
|     removeVencordSettingsListeners(); |     removeVencordSettingsListeners(); | ||||||
| 
 | 
 | ||||||
|     const { staticTitle, transparencyOption, enableMenu, customTitleBar } = Settings.store; |     const { staticTitle, transparencyOption, enableMenu, titleBar } = Settings.store; | ||||||
| 
 | 
 | ||||||
|     const { frameless, transparent } = VencordSettings.store; |     const { frameless, transparent } = VencordSettings.store; | ||||||
| 
 | 
 | ||||||
|     const noFrame = frameless === true || customTitleBar === true; |     const noFrame = frameless === true || titleBar === "hidden"; | ||||||
| 
 | 
 | ||||||
|     const win = (mainWin = new BrowserWindow({ |     const win = (mainWin = new BrowserWindow({ | ||||||
|         show: false, |         show: false, | ||||||
|  | @ -419,18 +419,20 @@ function createMainWindow() { | ||||||
|                 backgroundMaterial: transparencyOption |                 backgroundMaterial: transparencyOption | ||||||
|             }), |             }), | ||||||
|         // Fix transparencyOption for custom discord titlebar
 |         // Fix transparencyOption for custom discord titlebar
 | ||||||
|         ...(customTitleBar && |         ...(titleBar === "custom" && | ||||||
|             transparencyOption && |             transparencyOption && | ||||||
|             transparencyOption !== "none" && { |             transparencyOption !== "none" && { | ||||||
|                 transparent: true |                 transparent: true | ||||||
|             }), |             }), | ||||||
|         ...(staticTitle && { title: "Vesktop" }), |         ...(staticTitle && { title: "Vesktop" }), | ||||||
|         ...(process.platform === "darwin" && getDarwinOptions()), |         ...(process.platform === "darwin" && titleBar !== "shown" && getDarwinOptions()), // Show/Hide titlebar depending on settings on Mac
 | ||||||
|         ...getWindowBoundsOptions(), |         ...getWindowBoundsOptions(), | ||||||
|         autoHideMenuBar: enableMenu |         autoHideMenuBar: enableMenu | ||||||
|     })); |     })); | ||||||
|     win.setMenuBarVisibility(false); |     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 => { |     win.on("close", e => { | ||||||
|         const useTray = !isDeckGameMode && Settings.store.minimizeToTray !== false && Settings.store.tray !== false; |         const useTray = !isDeckGameMode && Settings.store.minimizeToTray !== false && Settings.store.tray !== false; | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ const DEFAULT_POPOUT_OPTIONS: BrowserWindowConstructorOptions = { | ||||||
|     backgroundColor: "#2f3136", |     backgroundColor: "#2f3136", | ||||||
|     minWidth: MIN_POPOUT_WIDTH, |     minWidth: MIN_POPOUT_WIDTH, | ||||||
|     minHeight: MIN_POPOUT_HEIGHT, |     minHeight: MIN_POPOUT_HEIGHT, | ||||||
|     frame: Settings.store.customTitleBar !== true, |     frame: Settings.store.titleBar !== "custom", | ||||||
|     titleBarStyle: process.platform === "darwin" ? "hidden" : undefined, |     titleBarStyle: process.platform === "darwin" ? "hidden" : undefined, | ||||||
|     trafficLightPosition: |     trafficLightPosition: | ||||||
|         process.platform === "darwin" |         process.platform === "darwin" | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ import { isMac, isWindows } from "renderer/utils"; | ||||||
| import { AutoStartToggle } from "./AutoStartToggle"; | import { AutoStartToggle } from "./AutoStartToggle"; | ||||||
| import { DiscordBranchPicker } from "./DiscordBranchPicker"; | import { DiscordBranchPicker } from "./DiscordBranchPicker"; | ||||||
| import { NotificationBadgeToggle } from "./NotificationBadgeToggle"; | import { NotificationBadgeToggle } from "./NotificationBadgeToggle"; | ||||||
|  | import { TitleBarPicker } from "./TitleBarPicker"; | ||||||
| import { VencordLocationPicker } from "./VencordLocationPicker"; | import { VencordLocationPicker } from "./VencordLocationPicker"; | ||||||
| import { WindowsTransparencyControls } from "./WindowsTransparencyControls"; | import { WindowsTransparencyControls } from "./WindowsTransparencyControls"; | ||||||
| 
 | 
 | ||||||
|  | @ -39,13 +40,8 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>> | ||||||
|             defaultValue: true |             defaultValue: true | ||||||
|         } |         } | ||||||
|     ], |     ], | ||||||
|     "User Interface": [ |     "Title Bar": [ | ||||||
|         { |         TitleBarPicker, | ||||||
|             key: "customTitleBar", |  | ||||||
|             title: "Discord Titlebar", |  | ||||||
|             description: "Use Discord's custom title bar instead of the native system one. Requires a full restart.", |  | ||||||
|             defaultValue: isWindows |  | ||||||
|         }, |  | ||||||
|         { |         { | ||||||
|             key: "staticTitle", |             key: "staticTitle", | ||||||
|             title: "Static Title", |             title: "Static Title", | ||||||
|  | @ -57,8 +53,11 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>> | ||||||
|             title: "Enable Menu Bar", |             title: "Enable Menu Bar", | ||||||
|             description: "Enables the application menu bar. Press ALT to toggle visibility.", |             description: "Enables the application menu bar. Press ALT to toggle visibility.", | ||||||
|             defaultValue: false, |             defaultValue: false, | ||||||
|             disabled: () => Settings.store.customTitleBar ?? isWindows |             invisible: () => isMac, | ||||||
|         }, |             disabled: () => Settings.store.titleBar === "custom" ?? isWindows | ||||||
|  |         } | ||||||
|  |     ], | ||||||
|  |     "User Interface": [ | ||||||
|         { |         { | ||||||
|             key: "splashTheming", |             key: "splashTheming", | ||||||
|             title: "Splash theming", |             title: "Splash theming", | ||||||
|  |  | ||||||
							
								
								
									
										36
									
								
								src/renderer/components/settings/TitleBarPicker.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/renderer/components/settings/TitleBarPicker.tsx
									
									
									
									
									
										Normal file
									
								
							|  | @ -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 ( | ||||||
|  |         <> | ||||||
|  |             <Forms.FormText className={Margins.bottom8}> | ||||||
|  |                 Customize apps title bar. Pick Discord if you want to use Discord's custom title bar. Requires a full | ||||||
|  |                 restart | ||||||
|  |             </Forms.FormText> | ||||||
|  | 
 | ||||||
|  |             <Select | ||||||
|  |                 placeholder="Hidden" | ||||||
|  |                 options={[ | ||||||
|  |                     ...(isMac ? [{ label: "Hidden", value: "hidden", default: isMac }] : []), | ||||||
|  |                     { label: "Native", value: "shown" }, | ||||||
|  |                     { label: "Discord", value: "custom", default: isWindows } | ||||||
|  |                 ]} | ||||||
|  |                 closeOnSelect={true} | ||||||
|  |                 select={v => (settings.titleBar = v)} | ||||||
|  |                 isSelected={v => v === settings.titleBar} | ||||||
|  |                 serialize={s => s} | ||||||
|  |             /> | ||||||
|  |             <Forms.FormDivider className={Margins.top16 + " " + Margins.bottom16} /> | ||||||
|  |         </> | ||||||
|  |     ); | ||||||
|  | }; | ||||||
|  | @ -22,7 +22,7 @@ addPatch({ | ||||||
|     ], |     ], | ||||||
| 
 | 
 | ||||||
|     getPlatformClass() { |     getPlatformClass() { | ||||||
|         if (Settings.store.customTitleBar) return "platform-win"; |         if (Settings.store.titleBar !== "hidden") return "platform-win"; | ||||||
|         if (isMac) return "platform-osx"; |         if (isMac) return "platform-osx"; | ||||||
|         return "platform-web"; |         return "platform-web"; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ import { Settings } from "renderer/settings"; | ||||||
| 
 | 
 | ||||||
| import { addPatch } from "./shared"; | import { addPatch } from "./shared"; | ||||||
| 
 | 
 | ||||||
| if (Settings.store.customTitleBar) | if (Settings.store.titleBar === "custom") | ||||||
|     addPatch({ |     addPatch({ | ||||||
|         patches: [ |         patches: [ | ||||||
|             { |             { | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								src/shared/settings.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								src/shared/settings.d.ts
									
									
									
									
										vendored
									
									
								
							|  | @ -20,7 +20,7 @@ export interface Settings { | ||||||
|     appBadge?: boolean; |     appBadge?: boolean; | ||||||
|     disableMinSize?: boolean; |     disableMinSize?: boolean; | ||||||
|     clickTrayToShowHide?: boolean; |     clickTrayToShowHide?: boolean; | ||||||
|     customTitleBar?: boolean; |     titleBar?: "hidden" | "shown" | "custom"; | ||||||
| 
 | 
 | ||||||
|     splashTheming?: boolean; |     splashTheming?: boolean; | ||||||
|     splashColor?: string; |     splashColor?: string; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 samara
						samara