feat: restore window position and size from Rust before frame creation#88
Merged
feat: restore window position and size from Rust before frame creation#88
Conversation
Replace tauri-plugin-window-state with self-managed geometry persistence. The Rust setup hook now reads config.json to check whether restoration is enabled and, if so, creates the main window at the saved position and size. On close, geometry is saved back to config.json in logical coordinates with off-screen detection fallback. - Add src-tauri/src/window.rs for window lifecycle management - Remove tauri-plugin-window-state from Rust and frontend deps - Remove frontend restoreStateCurrent() call in store-provider - Clear windows array in tauri.conf.json (now programmatic) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace
tauri-plugin-window-statewith self-managed window geometry persistence in Rust. The setup hook now readsconfig.jsonbefore creating the main window, applying saved position and size when the user setting is enabled. This eliminates the visual jump that occurred when the frontend restored geometry after the window was already visible.Changes
Rust backend
window.rs— Handles window creation, geometry save/restore, and off-screen detectionlib.rs— Removedtauri-plugin-window-stateplugin; window is now created programmatically in the setup hook withon_window_event(CloseRequested)to persist geometry on closeCargo.toml— Removedtauri-plugin-window-statedependencytauri.conf.json— Cleared thewindowsarray (window creation is now programmatic)capabilities/default.json— Removedwindow-state:defaultpermissionFrontend
store-provider.tsx— RemovedrestoreStateCurrent()call and@tauri-apps/plugin-window-stateimportwindowStateConfig.ts— Updated JSDoc to reflect Rust-side restorepackage.json— Removed@tauri-apps/plugin-window-statedependencyBehavior
Testing
cargo build/cargo clippy/tsc --noEmitpass