fix: kernel-caused silent mode failure to start windows

This commit is contained in:
huzibaca
2024-11-26 05:50:56 +08:00
parent 1cc6472002
commit 71cb2a97c0
2 changed files with 42 additions and 36 deletions

View File

@@ -20,12 +20,16 @@ use tauri_plugin_window_state::{AppHandleExt, StateFlags};
// 打开面板
pub fn open_or_close_dashboard() {
if let Some(window) = handle::Handle::global().get_window() {
if let Ok(true) = window.is_focused() {
// 如果窗口存在,则切换其显示状态
if window.is_visible().unwrap_or(false) {
let _ = window.hide();
return;
} else {
let _ = window.show();
let _ = window.set_focus();
}
} else {
resolve::create_window();
}
resolve::create_window();
}
// 重启clash