feat: persist Tauri window state (#2377)

Add the window-state plugin and explicitly save size and position across app exit, restart, and lightweight-mode transitions.
This commit is contained in:
BillSaul
2026-05-01 17:51:25 +08:00
committed by GitHub
parent 295dd9a944
commit 7b667f7a44
5 changed files with 48 additions and 1 deletions
+2
View File
@@ -42,6 +42,8 @@ pub async fn save_settings(settings: crate::settings::AppSettings) -> Result<boo
/// 重启应用程序(当 app_config_dir 变更后使用)
#[tauri::command]
pub async fn restart_app(app: AppHandle) -> Result<bool, String> {
crate::save_window_state_before_exit(&app);
// 在后台延迟重启,让函数有时间返回响应
tauri::async_runtime::spawn(async move {
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;