diff --git a/Cargo.lock b/Cargo.lock index b522b08e..5839b8c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -514,6 +514,7 @@ dependencies = [ "tauri-plugin-single-instance", "tauri-plugin-system-symbols", "tauri-plugin-window-controls", + "tauri-plugin-window-state", "ureq", "url", "webpki-roots 1.0.6", @@ -4686,6 +4687,21 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "tauri-plugin-window-state" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73736611e14142408d15353e21e3cca2f12a3cfb523ad0ce85999b6d2ef1a704" +dependencies = [ + "bitflags 2.11.0", + "log", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.18", +] + [[package]] name = "tauri-runtime" version = "2.11.3" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 85127320..2502b23f 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -51,6 +51,7 @@ notify = "8" [target.'cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))'.dependencies] tauri-plugin-system-symbols = "0.3" tauri-plugin-window-controls = "0.1" +tauri-plugin-window-state = "2" game-scanner = { git = "https://github.com/EqualGames/game-scanner", branch = "dependabot/cargo/sysinfo-0.28.2" } tauri-plugin-single-instance = { version = "2.4.3", features = ["deep-link"] } diff --git a/src-tauri/src/backend.rs b/src-tauri/src/backend.rs index bec50fba..249940dc 100644 --- a/src-tauri/src/backend.rs +++ b/src-tauri/src/backend.rs @@ -7693,9 +7693,20 @@ pub fn run() { } #[cfg(desktop)] { + // Remember the window geometry between launches. Only the size, + // position and maximized flag are restored: visibility and + // decorations stay under the app's control. + let window_state_flags = tauri_plugin_window_state::StateFlags::SIZE + | tauri_plugin_window_state::StateFlags::POSITION + | tauri_plugin_window_state::StateFlags::MAXIMIZED; builder = builder .plugin(tauri_plugin_system_symbols::init()) - .plugin(tauri_plugin_window_controls::init()); + .plugin(tauri_plugin_window_controls::init()) + .plugin( + tauri_plugin_window_state::Builder::default() + .with_state_flags(window_state_flags) + .build(), + ); } #[cfg(desktop)] {