feat: Support different tray icon for macos

This commit is contained in:
MystiPanda
2023-12-09 11:22:02 +08:00
Unverified
parent ffaa06560e
commit 125c3d3e0d
4 changed files with 10 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -136,13 +136,21 @@ impl Tray {
let tun_mode = verge.enable_tun_mode.as_ref().unwrap_or(&false);
let mut indication_icon = if *system_proxy {
include_bytes!("../../icons/tray-icon-activated.png").to_vec()
#[cfg(not(target_os = "macos"))]
let icon = include_bytes!("../../icons/tray-icon-sys.png").to_vec();
#[cfg(target_os = "macos")]
let icon = include_bytes!("../../icons/mac-tray-icon-sys.png").to_vec();
icon
} else {
include_bytes!("../../icons/tray-icon.png").to_vec()
};
if *tun_mode {
indication_icon = include_bytes!("../../icons/tray-icon-tun.png").to_vec();
#[cfg(not(target_os = "macos"))]
let icon = include_bytes!("../../icons/tray-icon-tun.png").to_vec();
#[cfg(target_os = "macos")]
let icon = include_bytes!("../../icons/mac-tray-icon-tun.png").to_vec();
indication_icon = icon
}
let _ = tray.set_icon(tauri::Icon::Raw(indication_icon));