From 761adf2476d057993764c2fa6362660fb77418fe Mon Sep 17 00:00:00 2001 From: Nexmoe <16796652+nexmoe@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:17:34 +0800 Subject: [PATCH] feat(tray): minimize to tray by default (#138) --- src/main/index.ts | 14 +++++++++++++- src/shared/types/index.ts | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 00c2380..7abb167 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -474,9 +474,21 @@ app.whenReady().then(async () => { handleDeepLinkArgv(process.argv) app.on('activate', () => { + const existingWindow = BrowserWindow.getAllWindows().find((window) => !window.isDestroyed()) + if (existingWindow) { + if (existingWindow.isMinimized()) { + existingWindow.restore() + } + if (!existingWindow.isVisible()) { + existingWindow.show() + } + existingWindow.focus() + return + } + // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. - if (BrowserWindow.getAllWindows().length === 0) createWindow() + createWindow() }) }) diff --git a/src/shared/types/index.ts b/src/shared/types/index.ts index e4fe123..cecbf01 100644 --- a/src/shared/types/index.ts +++ b/src/shared/types/index.ts @@ -301,7 +301,7 @@ export const defaultSettings: AppSettings = { oneClickDownload: false, oneClickDownloadType: 'video', oneClickQuality: 'best', - closeToTray: false, + closeToTray: true, hideDockIcon: false, launchAtLogin: false, autoUpdate: true,