save window state on window close

This commit is contained in:
Gregory Schier
2025-01-15 07:06:51 -08:00
parent ef8806212c
commit 0e21d901cd

View File

@@ -1954,14 +1954,16 @@ pub fn run() {
// Save window state on exit
match event {
RunEvent::ExitRequested{..} => {
let handle = app_handle.clone();
if let Err(e) = handle.save_window_state(StateFlags::all()) {
RunEvent::WindowEvent {
event: WindowEvent::CloseRequested { .. },
..
} => {
if let Err(e) = app_handle.save_window_state(StateFlags::all()) {
warn!("Failed to save window state {e:?}");
} else {
debug!("Saved window state");
};
},
}
_ => {}
};
});