@@ -44,6 +44,44 @@ let quitting = false;
4444const THEME_STORAGE_KEY = "clovapi-theme" ;
4545/** Matches renderer page background (title bar flash before paint). */
4646const WINDOW_BG_TOP = "#FBF9F9" ;
47+ const TITLE_BAR_OVERLAY_HEIGHT = 32 ;
48+
49+ function windowTitle ( ) {
50+ return `ClovAPI Switcher v${ app . getVersion ( ) } ` ;
51+ }
52+
53+ function buildBrowserWindowOptions ( ) {
54+ const options = {
55+ width : 700 ,
56+ height : 760 ,
57+ minWidth : 640 ,
58+ minHeight : 560 ,
59+ autoHideMenuBar : true ,
60+ backgroundColor : WINDOW_BG_TOP ,
61+ icon : windowIconPath ( ) ,
62+ title : windowTitle ( ) ,
63+ webPreferences : {
64+ preload : path . resolve ( __dirname , "preload.js" ) ,
65+ contextIsolation : true ,
66+ nodeIntegration : false ,
67+ sandbox : false ,
68+ } ,
69+ } ;
70+
71+ if ( process . platform === "win32" ) {
72+ options . titleBarStyle = "hidden" ;
73+ options . titleBarOverlay = {
74+ color : WINDOW_BG_TOP ,
75+ symbolColor : "#353535" ,
76+ height : TITLE_BAR_OVERLAY_HEIGHT ,
77+ } ;
78+ options . backgroundMaterial = "none" ;
79+ } else if ( process . platform === "darwin" ) {
80+ options . titleBarStyle = "hiddenInset" ;
81+ }
82+
83+ return options ;
84+ }
4785let coreDevWatcher = null ;
4886let coreDevRestartTimer = null ;
4987
@@ -338,22 +376,7 @@ function createTray() {
338376}
339377
340378function createWindow ( ) {
341- mainWindow = new BrowserWindow ( {
342- width : 700 ,
343- height : 760 ,
344- minWidth : 640 ,
345- minHeight : 560 ,
346- autoHideMenuBar : true ,
347- backgroundColor : WINDOW_BG_TOP ,
348- icon : windowIconPath ( ) ,
349- title : "ClovAPI Switcher" ,
350- webPreferences : {
351- preload : path . resolve ( __dirname , "preload.js" ) ,
352- contextIsolation : true ,
353- nodeIntegration : false ,
354- sandbox : false ,
355- } ,
356- } ) ;
379+ mainWindow = new BrowserWindow ( buildBrowserWindowOptions ( ) ) ;
357380 if ( isElectronDev ) {
358381 mainWindow . webContents . on ( "preload-error" , ( _event , preloadPath , error ) => {
359382 emitOutput ( "stderr" , `[dev] preload failed (${ preloadPath } ): ${ error ?. message || error } \n` ) ;
0 commit comments