From 92d1573cf082402b7f44a6beedbc47f58dc91781 Mon Sep 17 00:00:00 2001 From: Elysia Date: Sat, 31 Jan 2026 20:13:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=8E=B0=E5=9C=A8=E4=BB=85=E5=9C=A8?= =?UTF-8?q?=E6=9C=89=E4=BB=BB=E5=8A=A1=E6=97=B6=E6=89=8D=E4=BC=9A=E5=88=B0?= =?UTF-8?q?=E6=89=98=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main/backend/install-manager.ts | 2 +- electron/main/index.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/electron/main/backend/install-manager.ts b/electron/main/backend/install-manager.ts index 2268841c..efe5cacc 100644 --- a/electron/main/backend/install-manager.ts +++ b/electron/main/backend/install-manager.ts @@ -20,7 +20,7 @@ type InstallTask = { const SHELL_CALLER_PATH = '/opt/apm-store/extras/shell-caller.sh'; -const tasks = new Map(); +export const tasks = new Map(); let idle = true; // Indicates if the installation manager is idle diff --git a/electron/main/index.ts b/electron/main/index.ts index 41a32c07..ae9ae08f 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -7,6 +7,7 @@ import fs from 'node:fs' import pino from 'pino' import { handleCommandLine } from './deeplink.js' import { isLoaded } from '../global.js' +import { tasks } from './backend/install-manager.js' // Assure single instance application @@ -99,8 +100,14 @@ async function createWindow() { // 截获 close 默认行为 event.preventDefault(); // 点击关闭时触发close事件,我们按照之前的思路在关闭时,隐藏窗口,隐藏任务栏窗口 - win.hide(); - win.setSkipTaskbar(true); + if (tasks.size > 0) { + win.hide(); + win.setSkipTaskbar(true); + } else { + // 如果没有下载任务,才允许关闭窗口 + win.destroy() + } + }) }