Persist Tauri window state between launches (#5871)

This commit is contained in:
Anthony Stirling
2026-03-05 16:18:25 +00:00
committed by GitHub
parent 98835ce7b5
commit ba2d10a75b
4 changed files with 22 additions and 1 deletions

View File

@@ -4171,6 +4171,7 @@ dependencies = [
"tauri-plugin-shell",
"tauri-plugin-single-instance",
"tauri-plugin-store",
"tauri-plugin-window-state",
"tiny_http",
"tokio",
"url",
@@ -4678,6 +4679,21 @@ dependencies = [
"tracing",
]
[[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.10.0"

View File

@@ -34,6 +34,7 @@ tauri-plugin-single-instance = { version = "2.3.7", features = ["deep-link"] }
tauri-plugin-store = "2.4.2"
tauri-plugin-opener = "2.5.3"
tauri-plugin-deep-link = "2.4.6"
tauri-plugin-window-state = "2.2.1"
keyring = { version = "3.6.1", features = ["apple-native", "windows-native"] }
tokio = { version = "1.0", features = ["time", "sync"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "rustls-tls-native-roots"] }

View File

@@ -54,6 +54,9 @@
"dialog:allow-open",
"dialog:allow-save",
"opener:default",
"shell:allow-open"
"shell:allow-open",
"window-state:allow-filename",
"window-state:allow-restore-state",
"window-state:allow-save-window-state"
]
}

View File

@@ -60,6 +60,7 @@ pub fn run() {
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_store::Builder::new().build())
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_window_state::Builder::default().build())
.manage(AppConnectionState::default())
.plugin(tauri_plugin_single_instance::init(|app, args, _cwd| {
// This callback runs when a second instance tries to start