diff --git a/src/main/resolve/tray.ts b/src/main/resolve/tray.ts index 7ec25cc..2d18ae7 100644 --- a/src/main/resolve/tray.ts +++ b/src/main/resolve/tray.ts @@ -120,6 +120,7 @@ export const buildContextMenu = async (): Promise => { mainWindow?.webContents.send('controledMihomoConfigUpdated') mainWindow?.webContents.send('groupsUpdated') ipcMain.emit('updateTrayMenu') + await updateTrayIcon() } }, { @@ -134,6 +135,7 @@ export const buildContextMenu = async (): Promise => { mainWindow?.webContents.send('controledMihomoConfigUpdated') mainWindow?.webContents.send('groupsUpdated') ipcMain.emit('updateTrayMenu') + await updateTrayIcon() } }, { @@ -148,6 +150,7 @@ export const buildContextMenu = async (): Promise => { mainWindow?.webContents.send('controledMihomoConfigUpdated') mainWindow?.webContents.send('groupsUpdated') ipcMain.emit('updateTrayMenu') + await updateTrayIcon() } }, { type: 'separator' }, @@ -167,6 +170,7 @@ export const buildContextMenu = async (): Promise => { // ignore } finally { ipcMain.emit('updateTrayMenu') + await updateTrayIcon() } } }, @@ -219,6 +223,7 @@ export const buildContextMenu = async (): Promise => { // ignore } finally { ipcMain.emit('updateTrayMenu') + await updateTrayIcon() } } }, @@ -237,6 +242,7 @@ export const buildContextMenu = async (): Promise => { await changeCurrentProfile(item.id) mainWindow?.webContents.send('profileConfigUpdated') ipcMain.emit('updateTrayMenu') + await updateTrayIcon() } } }) @@ -381,7 +387,6 @@ async function updateTrayMenu(): Promise { if (process.platform === 'linux') { tray?.setContextMenu(menu) } - await updateTrayIcon() } export async function copyEnv(type: 'bash' | 'cmd' | 'powershell'): Promise {