diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 0a16b0d2..0072b0de 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2244,9 +2244,9 @@ dependencies = [ [[package]] name = "flexi_logger" -version = "0.31.6" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8ef54b052574866f68674c7646369a05dda785cf0ab8e3be94992fd92cd64b" +checksum = "31e5335674a3a259527f97e9176a3767dcc9b220b8e29d643daeb2d6c72caf8b" dependencies = [ "chrono", "log", diff --git a/src-tauri/src/core/tray/mod.rs b/src-tauri/src/core/tray/mod.rs index 7fb43dcd..6a25eae8 100644 --- a/src-tauri/src/core/tray/mod.rs +++ b/src-tauri/src/core/tray/mod.rs @@ -412,17 +412,24 @@ impl Tray { let tun_text = t("TUN").await; let profile_text = t("Profile").await; - let version = env!("CARGO_PKG_VERSION"); + let v = env!("CARGO_PKG_VERSION"); + let reassembled_version = v.split_once('+').map_or(v.to_string(), |(main, rest)| { + format!("{main}+{}", rest.split('.').next().unwrap_or("")) + }); + + let tooltip = format!( + "Clash Verge {}\n{}: {}\n{}: {}\n{}: {}", + reassembled_version, + sys_proxy_text, + switch_map[system_proxy], + tun_text, + switch_map[tun_mode], + profile_text, + current_profile_name + ); + if let Some(tray) = app_handle.tray_by_id("main") { - let _ = tray.set_tooltip(Some(&format!( - "Clash Verge {version}\n{}: {}\n{}: {}\n{}: {}", - sys_proxy_text, - switch_map[system_proxy], - tun_text, - switch_map[tun_mode], - profile_text, - current_profile_name - ))); + let _ = tray.set_tooltip(Some(&tooltip)); } else { log::warn!(target: "app", "更新托盘提示失败: 托盘不存在"); }