chore: update

This commit is contained in:
huzibaca 2024-12-24 06:03:23 +08:00
parent d9291d4f79
commit 2d2521e434
No known key found for this signature in database
GPG Key ID: D4364EE4851DC302

View File

@ -1,4 +1,3 @@
#[cfg(not(target_os = "macos"))]
use crate::utils::dirs;
use crate::{
cmds,
@ -97,12 +96,11 @@ impl Tray {
let verge = Config::verge().latest().clone();
let system_proxy = verge.enable_system_proxy.as_ref().unwrap_or(&false);
let tun_mode = verge.enable_tun_mode.as_ref().unwrap_or(&false);
#[cfg(not(target_os = "macos"))]
{
let common_tray_icon = verge.common_tray_icon.as_ref().unwrap_or(&false);
let sysproxy_tray_icon = verge.sysproxy_tray_icon.as_ref().unwrap_or(&false);
let tun_tray_icon = verge.tun_tray_icon.as_ref().unwrap_or(&false);
}
let tray = app_handle.tray_by_id("main").unwrap();
#[cfg(target_os = "macos")]
@ -110,15 +108,12 @@ impl Tray {
let icon_bytes = if *system_proxy && !*tun_mode {
#[cfg(target_os = "macos")]
{
let icon = match tray_icon.as_str() {
let mut icon = match tray_icon.as_str() {
"colorful" => include_bytes!("../../icons/tray-icon-sys.ico").to_vec(),
_ => include_bytes!("../../icons/tray-icon-sys-mono.ico").to_vec(),
};
icon
}
#[cfg(not(target_os = "macos"))]
{
let mut icon = include_bytes!("../../icons/tray-icon-sys.ico").to_vec();
if *sysproxy_tray_icon {
let icon_dir_path = dirs::app_home_dir()?.join("icons");
@ -131,18 +126,14 @@ impl Tray {
}
}
icon
}
} else if *tun_mode {
#[cfg(target_os = "macos")]
{
let icon = match tray_icon.as_str() {
let mut icon = match tray_icon.as_str() {
"colorful" => include_bytes!("../../icons/tray-icon-tun.ico").to_vec(),
_ => include_bytes!("../../icons/tray-icon-tun-mono.ico").to_vec(),
};
icon
}
#[cfg(not(target_os = "macos"))]
{
let mut icon = include_bytes!("../../icons/tray-icon-tun.ico").to_vec();
if *tun_tray_icon {
let icon_dir_path = dirs::app_home_dir()?.join("icons");
@ -155,18 +146,14 @@ impl Tray {
}
}
icon
}
} else {
#[cfg(target_os = "macos")]
{
let icon = match tray_icon.as_str() {
let mut icon = match tray_icon.as_str() {
"colorful" => include_bytes!("../../icons/tray-icon.ico").to_vec(),
_ => include_bytes!("../../icons/tray-icon-mono.ico").to_vec(),
};
icon
}
#[cfg(not(target_os = "macos"))]
{
let mut icon = include_bytes!("../../icons/tray-icon.ico").to_vec();
if *common_tray_icon {
let icon_dir_path = dirs::app_home_dir()?.join("icons");
@ -179,7 +166,6 @@ impl Tray {
}
}
icon
}
};
#[cfg(target_os = "macos")]