fix: tray tooltip not updating

This commit is contained in:
huzibaca 2025-01-13 13:01:12 +08:00
parent f2cc116ff9
commit 5bff7ea469
No known key found for this signature in database
GPG Key ID: D4364EE4851DC302
2 changed files with 8 additions and 1 deletions

View File

@ -4,7 +4,7 @@ use crate::{
feat, feat,
utils::{dirs, help}, utils::{dirs, help},
}; };
use crate::{ret_err, wrap_err}; use crate::{log_err, ret_err, wrap_err};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use network_interface::NetworkInterface; use network_interface::NetworkInterface;
use serde_yaml::Mapping; use serde_yaml::Mapping;
@ -28,6 +28,7 @@ pub fn get_profiles() -> CmdResult<IProfiles> {
#[tauri::command] #[tauri::command]
pub async fn enhance_profiles() -> CmdResult { pub async fn enhance_profiles() -> CmdResult {
wrap_err!(CoreManager::global().update_config().await)?; wrap_err!(CoreManager::global().update_config().await)?;
log_err!(tray::Tray::global().update_tooltip());
handle::Handle::refresh_clash(); handle::Handle::refresh_clash();
Ok(()) Ok(())
} }

View File

@ -205,10 +205,12 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> {
let mut should_update_systray_icon = false; let mut should_update_systray_icon = false;
let mut should_update_hotkey = false; let mut should_update_hotkey = false;
let mut should_update_systray_menu = false; let mut should_update_systray_menu = false;
let mut should_update_systray_tooltip = false;
if tun_mode.is_some() { if tun_mode.is_some() {
should_update_clash_config = true; should_update_clash_config = true;
should_update_systray_menu = true; should_update_systray_menu = true;
should_update_systray_tooltip = true;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
should_update_systray_icon = true; should_update_systray_icon = true;
@ -239,6 +241,7 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> {
if system_proxy.is_some() { if system_proxy.is_some() {
should_update_sysproxy = true; should_update_sysproxy = true;
should_update_systray_menu = true; should_update_systray_menu = true;
should_update_systray_tooltip = true;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
should_update_systray_icon = true; should_update_systray_icon = true;
@ -292,6 +295,9 @@ pub async fn patch_verge(patch: IVerge) -> Result<()> {
tray::Tray::global().update_icon(None)?; tray::Tray::global().update_icon(None)?;
} }
if should_update_systray_tooltip {
tray::Tray::global().update_tooltip()?;
}
<Result<()>>::Ok(()) <Result<()>>::Ok(())
}; };
match res { match res {