add proxy memu in tray

This commit is contained in:
Kasserrr
2025-08-28 01:25:09 +08:00
Unverified
parent d58c0a7df5
commit f566a564af
7 changed files with 345 additions and 29 deletions

View File

@@ -45,3 +45,20 @@ pub async fn get_providers_proxies() -> CmdResult<serde_json::Value> {
.await;
Ok((*value).clone())
}
/// 同步托盘和GUI的代理选择状态
#[tauri::command]
pub async fn sync_tray_proxy_selection() -> CmdResult<()> {
use crate::core::tray::Tray;
match Tray::global().update_menu().await {
Ok(_) => {
logging!(info, Type::Cmd, "Tray proxy selection synced successfully");
Ok(())
}
Err(e) => {
logging!(error, Type::Cmd, "Failed to sync tray proxy selection: {e}");
Err(e.to_string())
}
}
}