This commit is contained in:
2025-07-18 16:40:49 +08:00
parent 0b2974e2c9
commit 6fe479448c
4 changed files with 33 additions and 31 deletions

View File

@@ -23,6 +23,13 @@ export async function clearBrowserCache() {
}
export function createTray() {
// 防止重复创建托盘
if (tray) {
logger.info('托盘已存在,跳过创建')
return
}
logger.info('开始创建托盘图标')
// 创建托盘图标
tray = new Tray(icon)
@@ -165,7 +172,11 @@ export function createTray() {
export function destroyTray() {
if (tray) {
logger.info('销毁托盘图标')
tray.destroy()
tray = null
logger.info('托盘图标已销毁')
} else {
logger.info('托盘图标不存在,无需销毁')
}
}