File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ app.disableHardwareAcceleration();
1818
1919// Global references
2020let mainWindow : BrowserWindow | null = null ;
21+ let isQuitting = false ;
2122const gatewayManager = new GatewayManager ( ) ;
2223const clawHubService = new ClawHubService ( ) ;
2324
@@ -159,7 +160,14 @@ async function initialize(): Promise<void> {
159160 // Note: Auto-check for updates is driven by the renderer (update store init)
160161 // so it respects the user's "Auto-check for updates" setting.
161162
162- // Handle window close
163+ // Windows: minimize to tray on close instead of quitting
164+ mainWindow . on ( 'close' , ( event ) => {
165+ if ( process . platform === 'win32' && ! isQuitting ) {
166+ event . preventDefault ( ) ;
167+ mainWindow ?. hide ( ) ;
168+ }
169+ } ) ;
170+
163171 mainWindow . on ( 'closed' , ( ) => {
164172 mainWindow = null ;
165173 } ) ;
@@ -195,6 +203,7 @@ app.on('window-all-closed', () => {
195203} ) ;
196204
197205app . on ( 'before-quit' , async ( ) => {
206+ isQuitting = true ;
198207 await gatewayManager . stop ( ) ;
199208} ) ;
200209
You can’t perform that action at this time.
0 commit comments