fix: windows cannot save window state

This commit is contained in:
huzibaca 2024-11-19 23:32:32 +08:00
parent 18b0c3f7aa
commit 95b7641f9c
2 changed files with 1 additions and 3 deletions

View File

@ -124,6 +124,7 @@ pub fn quit(code: Option<i32>) {
resolve::restore_public_dns().await; resolve::restore_public_dns().await;
}); });
log_err!(app_handle.save_window_state(StateFlags::default()));
app_handle.exit(code.unwrap_or(0)); app_handle.exit(code.unwrap_or(0));
} }

View File

@ -9,7 +9,6 @@ use crate::core::hotkey;
use crate::utils::{resolve, resolve::resolve_scheme, server}; use crate::utils::{resolve, resolve::resolve_scheme, server};
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
use tauri::Listener; use tauri::Listener;
use tauri_plugin_window_state::{AppHandleExt, StateFlags};
pub fn run() { pub fn run() {
// 单例检测 // 单例检测
@ -147,8 +146,6 @@ pub fn run() {
api.prevent_exit(); api.prevent_exit();
return; return;
} }
let app_hanele = core::handle::Handle::global().app_handle().unwrap();
let _ = app_hanele.save_window_state(StateFlags::default());
} }
tauri::RunEvent::WindowEvent { label, event, .. } => { tauri::RunEvent::WindowEvent { label, event, .. } => {
if label == "main" { if label == "main" {