feat: save window size and position

This commit is contained in:
GyDi
2023-07-22 10:58:16 +08:00
parent 8028e145f1
commit 038e93ea6a
4 changed files with 71 additions and 11 deletions

View File

@@ -109,6 +109,8 @@ fn main() -> std::io::Result<()> {
match event {
tauri::WindowEvent::CloseRequested { api, .. } => {
api.prevent_close();
let _ = resolve::save_window_size_position(&app_handle);
app_handle.get_window("main").map(|win| {
let _ = win.hide();
});
@@ -117,6 +119,19 @@ fn main() -> std::io::Result<()> {
}
}
}
#[cfg(not(target_os = "macos"))]
tauri::RunEvent::WindowEvent { label, event, .. } => {
use tauri::Manager;
if label == "main" {
match event {
tauri::WindowEvent::CloseRequested { .. } => {
let _ = resolve::save_window_size_position(&app_handle);
}
_ => {}
}
}
}
_ => {}
});