feat: Close to tray
This commit is contained in:
@@ -7,7 +7,13 @@ import {
|
||||
destroyDatabase,
|
||||
getDataSource
|
||||
} from '../db/database';
|
||||
import { createWindow, getDockIconPath } from '../window/create-window';
|
||||
import {
|
||||
createWindow,
|
||||
getDockIconPath,
|
||||
getMainWindow,
|
||||
prepareWindowForAppQuit,
|
||||
showMainWindow
|
||||
} from '../window/create-window';
|
||||
import {
|
||||
setupCqrsHandlers,
|
||||
setupSystemHandlers,
|
||||
@@ -30,8 +36,13 @@ export function registerAppLifecycle(): void {
|
||||
await createWindow();
|
||||
|
||||
app.on('activate', () => {
|
||||
if (getMainWindow()) {
|
||||
void showMainWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
if (BrowserWindow.getAllWindows().length === 0)
|
||||
createWindow();
|
||||
void createWindow();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,6 +52,8 @@ export function registerAppLifecycle(): void {
|
||||
});
|
||||
|
||||
app.on('before-quit', async (event) => {
|
||||
prepareWindowForAppQuit();
|
||||
|
||||
if (getDataSource()?.isInitialized) {
|
||||
event.preventDefault();
|
||||
shutdownDesktopUpdater();
|
||||
|
||||
Reference in New Issue
Block a user