diff --git a/src-tauri/src/cmds.rs b/src-tauri/src/cmds.rs index 20a12a3f..9fe70b12 100644 --- a/src-tauri/src/cmds.rs +++ b/src-tauri/src/cmds.rs @@ -4,7 +4,7 @@ use crate::{ feat, utils::{dirs, help}, }; -use crate::{ret_err, wrap_err}; +use crate::{log_err, ret_err, wrap_err}; use anyhow::{Context, Result}; use network_interface::NetworkInterface; use serde_yaml::Mapping; @@ -28,6 +28,7 @@ pub fn get_profiles() -> CmdResult { #[tauri::command] pub async fn enhance_profiles() -> CmdResult { wrap_err!(CoreManager::global().update_config().await)?; + log_err!(tray::Tray::global().update_tooltip()); handle::Handle::refresh_clash(); Ok(()) } diff --git a/src-tauri/src/feat.rs b/src-tauri/src/feat.rs index 3d1743a0..6b0a53ee 100644 --- a/src-tauri/src/feat.rs +++ b/src-tauri/src/feat.rs @@ -205,10 +205,12 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> { let mut should_update_systray_icon = false; let mut should_update_hotkey = false; let mut should_update_systray_menu = false; + let mut should_update_systray_tooltip = false; if tun_mode.is_some() { should_update_clash_config = true; should_update_systray_menu = true; + should_update_systray_tooltip = true; #[cfg(target_os = "macos")] { should_update_systray_icon = true; @@ -239,6 +241,7 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> { if system_proxy.is_some() { should_update_sysproxy = true; should_update_systray_menu = true; + should_update_systray_tooltip = true; #[cfg(target_os = "macos")] { should_update_systray_icon = true; @@ -292,6 +295,9 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> { tray::Tray::global().update_icon(None)?; } + if should_update_systray_tooltip { + tray::Tray::global().update_tooltip()?; + } >::Ok(()) }; match res {