fix: macos not change icon

This commit is contained in:
GyDi 2023-05-28 16:46:17 +08:00
parent b1f45752cf
commit cafc2060b8

View File

@ -107,13 +107,16 @@ impl Tray {
let system_proxy = verge.enable_system_proxy.as_ref().unwrap_or(&false); 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 tun_mode = verge.enable_tun_mode.as_ref().unwrap_or(&false);
#[cfg(not(target_os = "macos"))]
{
let indication_icon = if *system_proxy { let indication_icon = if *system_proxy {
include_bytes!("../../icons/tray-icon-activated.png").to_vec() include_bytes!("../../icons/tray-icon-activated.png").to_vec()
} else { } else {
include_bytes!("../../icons/tray-icon.png").to_vec() 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("system_proxy").set_selected(*system_proxy);
let _ = tray.get_item("tun_mode").set_selected(*tun_mode); let _ = tray.get_item("tun_mode").set_selected(*tun_mode);