feat: allow app to minimize on the systemTray. Could be disable on purpose.

This commit is contained in:
MasterAcnolo
2026-08-09 09:58:55 +02:00
parent 5f28aa502a
commit e398f6866a
8 changed files with 147 additions and 8 deletions

View File

@@ -81,6 +81,19 @@ async function createMainWindow() {
throw err;
}
/**
* Intercepts the window close event.
* If the app is not explicitly quitting (via Tray menu),
* cancels the destruction and hides the window instead.
*/
mainWindow.on('close', (event) => {
if (!app.isQuitting) {
event.preventDefault();
mainWindow.hide();
return false;
}
});
/**
* Cleans up window reference when the main window is closed.
* Prevents memory leaks and allows recreation if needed.