fix: Update tray menu event handling to toggle lightweight mode based on current state #4785

This commit is contained in:
Tunglies
2025-09-18 00:46:01 +08:00
parent c207516b47
commit 5d2e114b4d
2 changed files with 7 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
- 优化服务模式重装逻辑,避免不必要的重复检查 - 优化服务模式重装逻辑,避免不必要的重复检查
- 修复轻量模式退出无响应的问题 - 修复轻量模式退出无响应的问题
- 修复托盘轻量模式支持退出/进入
- macOS Tun/系统代理 模式下图标大小不统一 - macOS Tun/系统代理 模式下图标大小不统一
- 托盘节点切换不再显示隐藏组 - 托盘节点切换不再显示隐藏组

View File

@@ -997,7 +997,12 @@ fn on_menu_event(_: &AppHandle, event: MenuEvent) {
if !should_handle_tray_click() { if !should_handle_tray_click() {
return; return;
} }
if !is_in_lightweight_mode() {
lightweight::entry_lightweight_mode().await; // Await async function lightweight::entry_lightweight_mode().await; // Await async function
} else {
lightweight::exit_lightweight_mode().await; // Await async function
}
} }
"quit" => { "quit" => {
feat::quit().await; // Await async function feat::quit().await; // Await async function