mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-02-11 04:00:32 +08:00
fix: prevent tray icon flickering when showTraffic enabled on macOS
This commit is contained in:
parent
ae42750f34
commit
291abc0a0d
@ -528,8 +528,10 @@ export function updateTrayIconImmediate(sysProxyEnabled: boolean, tunEnabled: bo
|
|||||||
const status = calculateTrayIconStatus(sysProxyEnabled, tunEnabled)
|
const status = calculateTrayIconStatus(sysProxyEnabled, tunEnabled)
|
||||||
const iconPaths = getIconPaths()
|
const iconPaths = getIconPaths()
|
||||||
|
|
||||||
getAppConfig().then(({ disableTrayIconColor = false }) => {
|
getAppConfig().then(({ disableTrayIconColor = false, showTraffic = false }) => {
|
||||||
if (!tray) return
|
if (!tray) return
|
||||||
|
// macOS 开启流量显示时,由 trayIconUpdate 负责图标更新
|
||||||
|
if (process.platform === 'darwin' && showTraffic) return
|
||||||
const iconPath = disableTrayIconColor ? iconPaths.white : iconPaths[status]
|
const iconPath = disableTrayIconColor ? iconPaths.white : iconPaths[status]
|
||||||
try {
|
try {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
@ -549,7 +551,9 @@ export function updateTrayIconImmediate(sysProxyEnabled: boolean, tunEnabled: bo
|
|||||||
export async function updateTrayIcon(): Promise<void> {
|
export async function updateTrayIcon(): Promise<void> {
|
||||||
if (!tray) return
|
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 status = await getTrayIconStatus()
|
||||||
const iconPaths = getIconPaths()
|
const iconPaths = getIconPaths()
|
||||||
const iconPath = disableTrayIconColor ? iconPaths.white : iconPaths[status]
|
const iconPath = disableTrayIconColor ? iconPaths.white : iconPaths[status]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user