Skip to content

Commit 298a92d

Browse files
hazeoneBIGWOO
authored andcommitted
feat(electron): implement minimize to tray on close for Windows (ValueCell-ai#106)
1 parent 1293341 commit 298a92d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

electron/main/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ app.disableHardwareAcceleration();
1818

1919
// Global references
2020
let mainWindow: BrowserWindow | null = null;
21+
let isQuitting = false;
2122
const gatewayManager = new GatewayManager();
2223
const 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

197205
app.on('before-quit', async () => {
206+
isQuitting = true;
198207
await gatewayManager.stop();
199208
});
200209

0 commit comments

Comments
 (0)