refactor(window): avoid double toggle (#6377)

This commit is contained in:
Slinetrac 2026-02-26 17:14:22 +08:00 committed by GitHub
parent 262b6f8adf
commit a7a4c3e59c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,14 +6,12 @@ use crate::utils::window_manager::WindowManager;
use clash_verge_logging::{Type, logging};
use tokio::time::{Duration, timeout};
/// Public API: open or close the dashboard
pub async fn open_or_close_dashboard() {
open_or_close_dashboard_internal().await
}
if lightweight::is_in_lightweight_mode() {
let _ = lightweight::exit_lightweight_mode().await;
return;
}
/// Internal implementation for opening/closing dashboard
async fn open_or_close_dashboard_internal() {
let _ = lightweight::exit_lightweight_mode().await;
let result = WindowManager::toggle_main_window().await;
logging!(info, Type::Window, "Window toggle result: {result:?}");
}