From 291abc0a0d4e2504b4f240674f57b0292c289951 Mon Sep 17 00:00:00 2001 From: xmk23333 Date: Thu, 15 Jan 2026 21:02:34 +0800 Subject: [PATCH] fix: prevent tray icon flickering when showTraffic enabled on macOS --- src/main/resolve/tray.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/resolve/tray.ts b/src/main/resolve/tray.ts index b8d987b..d8caeca 100644 --- a/src/main/resolve/tray.ts +++ b/src/main/resolve/tray.ts @@ -528,8 +528,10 @@ export function updateTrayIconImmediate(sysProxyEnabled: boolean, tunEnabled: bo const status = calculateTrayIconStatus(sysProxyEnabled, tunEnabled) const iconPaths = getIconPaths() - getAppConfig().then(({ disableTrayIconColor = false }) => { + getAppConfig().then(({ disableTrayIconColor = false, showTraffic = false }) => { if (!tray) return + // macOS 开启流量显示时,由 trayIconUpdate 负责图标更新 + if (process.platform === 'darwin' && showTraffic) return const iconPath = disableTrayIconColor ? iconPaths.white : iconPaths[status] try { if (process.platform === 'darwin') { @@ -549,7 +551,9 @@ export function updateTrayIconImmediate(sysProxyEnabled: boolean, tunEnabled: bo export async function updateTrayIcon(): Promise { if (!tray) return - const { disableTrayIconColor = false } = await getAppConfig() + const { disableTrayIconColor = false, showTraffic = false } = await getAppConfig() + // macOS 开启流量显示时,由 trayIconUpdate 负责图标更新 + if (process.platform === 'darwin' && showTraffic) return const status = await getTrayIconStatus() const iconPaths = getIconPaths() const iconPath = disableTrayIconColor ? iconPaths.white : iconPaths[status]