From 7e30114ef28d06bc2173fd870e02b701cddf2fbf Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Wed, 14 Aug 2024 13:28:30 +0800 Subject: [PATCH] auto destroy window --- src/main/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/index.ts b/src/main/index.ts index 9fe0e63..206a420 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -159,6 +159,14 @@ export function createWindow(show = false): void { if (!silentStart || show) { mainWindow?.show() mainWindow?.focusOnWebView() + } else { + if (destroyTimer) { + clearTimeout(destroyTimer) + } + destroyTimer = setTimeout(() => { + mainWindow?.destroy() + mainWindow = null + }, 300000) } })