This plugin provides a Tauri Plugin that saves the window position and size and restores it when the app is reopened.
There are three general methods of installation that we can recommend.
- Pull sources directly from Github using git tags / revision hashes (most secure, good for developement, shown below)
- Git submodule install this repo in your tauri project and then use
file
protocol to ingest the source - Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
For more details and usage see the example app.
Please note, below in the dependencies you can also lock to a revision/tag in the Cargo.toml
.
src-tauri/Cargo.toml
[dependencies]
tauri = "1.0"
tauri-plugin-window-state = "0.1"
Use in src-tauri/src/main.rs
:
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_window_state::Builder::default().build())
.run();
}
To prevent flashes when the window is updated, the window visible
property must be set to false
.
The plugin is responsible for showing it after restoring its state.
MIT / Apache-2.0