From 5eeb168998662f83fc53a2589b0fe236d766d49b Mon Sep 17 00:00:00 2001 From: totono Date: Thu, 30 Mar 2023 21:56:05 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=83=AA=E3=82=B5=E3=82=A4?= =?UTF-8?q?=E3=82=BA=E6=99=82=E3=81=AB=E3=82=B5=E3=82=A4=E3=82=BA=E3=81=A8?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E3=82=92=E4=BF=9D=E5=AD=98=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f3e7725..71916c6 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,6 +9,7 @@ use query::{task_list}; use store::AppState; use system_tray::{create_system_tray, system_tray_event}; use tauri::Manager; +use tauri_plugin_window_state::{AppHandleExt, StateFlags}; mod mutation; mod query; @@ -45,12 +46,16 @@ fn main() { Ok(()) }) .on_window_event(|event| { + let window = event.window().get_window("main").expect("falied to get window"); if let tauri::WindowEvent::CloseRequested { api, .. } = event.event() { event.window().minimize().unwrap(); - let window = event.window().get_window("main").expect("falied to get window"); window.set_skip_taskbar(true).unwrap(); api.prevent_close(); } + if let tauri::WindowEvent::Resized(_) = event.event() { + let _ = event.window().app_handle().save_window_state(StateFlags::all()); + } + }) .invoke_handler(tauri::generate_handler![ task_list,