还原轻量模式的进入和退出行为 (#4817)

同时把轻量模式系统托盘id改为lightweight_mode
This commit is contained in:
Junkai W.
2025-09-21 15:02:55 +08:00
committed by GitHub
parent 3493580236
commit 8f88270cdf

View File

@@ -875,7 +875,7 @@ async fn create_tray_menu(
let lighteweight_mode = &CheckMenuItem::with_id(
app_handle,
"entry_lightweight_mode",
"lightweight_mode",
lightweight_mode_text,
true,
is_lightweight_mode,
@@ -1029,11 +1029,15 @@ fn on_menu_event(_: &AppHandle, event: MenuEvent) {
}
"restart_clash" => feat::restart_clash_core().await, // Await async function
"restart_app" => feat::restart_app().await, // Await async function
"entry_lightweight_mode" => {
"lightweight_mode" => {
if !should_handle_tray_click() {
return;
}
lightweight::entry_lightweight_mode().await; // Await async function
if !is_in_lightweight_mode() {
lightweight::entry_lightweight_mode().await; // Await async function
} else {
lightweight::exit_lightweight_mode().await; // Await async function
}
}
"quit" => {
feat::quit().await; // Await async function