@@ -10,6 +10,7 @@ declare const __EMBEDDED_MARCODE_JIRA_TOKEN_PROXY_URL__: string;
1010import {
1111 app ,
1212 BrowserWindow ,
13+ type BrowserWindowConstructorOptions ,
1314 clipboard ,
1415 dialog ,
1516 ipcMain ,
@@ -154,6 +155,16 @@ function normalizeContextMenuItems(source: readonly ContextMenuItem[]): ContextM
154155 return normalizedItems ;
155156}
156157
158+ const TITLEBAR_HEIGHT = 40 ;
159+ const TITLEBAR_COLOR = "#01000000" ; // #00000000 does not work correctly on Linux
160+ const TITLEBAR_LIGHT_SYMBOL_COLOR = "#1f2937" ;
161+ const TITLEBAR_DARK_SYMBOL_COLOR = "#f8fafc" ;
162+
163+ type WindowTitleBarOptions = Pick <
164+ BrowserWindowConstructorOptions ,
165+ "titleBarOverlay" | "titleBarStyle" | "trafficLightPosition"
166+ > ;
167+
157168type DesktopUpdateErrorContext = DesktopUpdateState [ "errorContext" ] ;
158169type LinuxDesktopNamedApp = Electron . App & {
159170 setDesktopName ?: ( desktopName : string ) => void ;
@@ -1716,6 +1727,46 @@ function saveWindowState(window: BrowserWindow): void {
17161727 writeWindowState ( WINDOW_STATE_PATH , lastWindowState ) ;
17171728}
17181729
1730+ function getWindowTitleBarOptions ( ) : WindowTitleBarOptions {
1731+ if ( process . platform === "darwin" ) {
1732+ return {
1733+ titleBarStyle : "hiddenInset" ,
1734+ trafficLightPosition : { x : 16 , y : 18 } ,
1735+ } ;
1736+ }
1737+
1738+ return {
1739+ titleBarStyle : "hidden" ,
1740+ titleBarOverlay : {
1741+ color : TITLEBAR_COLOR ,
1742+ height : TITLEBAR_HEIGHT ,
1743+ symbolColor : nativeTheme . shouldUseDarkColors
1744+ ? TITLEBAR_DARK_SYMBOL_COLOR
1745+ : TITLEBAR_LIGHT_SYMBOL_COLOR ,
1746+ } ,
1747+ } ;
1748+ }
1749+
1750+ function syncWindowAppearance ( window : BrowserWindow ) : void {
1751+ if ( window . isDestroyed ( ) ) {
1752+ return ;
1753+ }
1754+
1755+ window . setBackgroundColor ( getInitialWindowBackgroundColor ( ) ) ;
1756+ const { titleBarOverlay } = getWindowTitleBarOptions ( ) ;
1757+ if ( typeof titleBarOverlay === "object" ) {
1758+ window . setTitleBarOverlay ( titleBarOverlay ) ;
1759+ }
1760+ }
1761+
1762+ function syncAllWindowAppearance ( ) : void {
1763+ for ( const window of BrowserWindow . getAllWindows ( ) ) {
1764+ syncWindowAppearance ( window ) ;
1765+ }
1766+ }
1767+
1768+ nativeTheme . on ( "updated" , syncAllWindowAppearance ) ;
1769+
17191770function createWindow ( options ?: { deferLoad ?: boolean } ) : BrowserWindow {
17201771 const restoredBounds = resolveWindowBounds ( lastWindowState ) ;
17211772
@@ -1728,8 +1779,7 @@ function createWindow(options?: { deferLoad?: boolean }): BrowserWindow {
17281779 backgroundColor : getInitialWindowBackgroundColor ( ) ,
17291780 ...getIconOption ( ) ,
17301781 title : APP_DISPLAY_NAME ,
1731- titleBarStyle : "hiddenInset" ,
1732- trafficLightPosition : { x : 16 , y : 18 } ,
1782+ ...getWindowTitleBarOptions ( ) ,
17331783 webPreferences : {
17341784 preload : Path . join ( __dirname , "preload.js" ) ,
17351785 contextIsolation : true ,
0 commit comments