From cafc2060b880affc0a213dec754bc724fd2918ce Mon Sep 17 00:00:00 2001 From: GyDi Date: Sun, 28 May 2023 16:46:17 +0800 Subject: [PATCH] fix: macos not change icon --- src-tauri/src/core/tray.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/core/tray.rs b/src-tauri/src/core/tray.rs index acf9142..f91db98 100644 --- a/src-tauri/src/core/tray.rs +++ b/src-tauri/src/core/tray.rs @@ -107,13 +107,16 @@ impl Tray { let system_proxy = verge.enable_system_proxy.as_ref().unwrap_or(&false); let tun_mode = verge.enable_tun_mode.as_ref().unwrap_or(&false); - let indication_icon = if *system_proxy { - include_bytes!("../../icons/tray-icon-activated.png").to_vec() - } else { - include_bytes!("../../icons/tray-icon.png").to_vec() - }; + #[cfg(not(target_os = "macos"))] + { + let indication_icon = if *system_proxy { + include_bytes!("../../icons/tray-icon-activated.png").to_vec() + } else { + include_bytes!("../../icons/tray-icon.png").to_vec() + }; - tray.set_icon(tauri::Icon::Raw(indication_icon))?; + let _ = tray.set_icon(tauri::Icon::Raw(indication_icon)); + } let _ = tray.get_item("system_proxy").set_selected(*system_proxy); let _ = tray.get_item("tun_mode").set_selected(*tun_mode);