Skip to content

Feature: Remember the previous window position & size#30

Open
grassified wants to merge 2 commits intoFrogSnot:masterfrom
grassified:master
Open

Feature: Remember the previous window position & size#30
grassified wants to merge 2 commits intoFrogSnot:masterfrom
grassified:master

Conversation

@grassified
Copy link
Copy Markdown
Contributor

@grassified grassified commented Apr 5, 2026

Description

This PR adds the functionality to remember window positions & sizes from the previous app shutdown.

This change requires adding two new dependencies:

  • Rust crate: tauri-plugin-window-state (v2)
  • NPM package: @tauri-apps/plugin-window-state
    These are official Tauri plugins designed to be extremely lightweight and probably the best options for this feature.

The Sunder Checklist

  • This PR is atomic. It adds exactly ONE feature or fix.
  • This PR is small. It touches fewer than 10 files and is under 500 lines of code. (If it's larger, please split it up, or if it must be large discuss it first in a issue).
  • Zero Bloat. I did not add any heavy dependencies (like reqwest or TLS) without discussing it in an issue first.
  • No Ghost Code. There is no unused config or dead code left over for future features.
  • I have ran cargo fmt and cargo clippy locally.

Summary by CodeRabbit

  • New Features
    • Window state management added — window size and position are now persisted and restored across launches for a more consistent experience.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 00cc3234-855e-4aea-92f2-667a7362ad75

📥 Commits

Reviewing files that changed from the base of the PR and between a2e4dde and fd154a2.

📒 Files selected for processing (1)
  • src-tauri/capabilities/default.json
✅ Files skipped from review due to trivial changes (1)
  • src-tauri/capabilities/default.json

📝 Walkthrough

Walkthrough

Added a window-state plugin: npm and Cargo dependencies were added, the plugin was registered in the Tauri builder, and the default Tauri capability permissions were updated to include window-state:default.

Changes

Cohort / File(s) Summary
Node dependency
package.json
Added @tauri-apps/plugin-window-state to npm dependencies (trailing-comma formatting adjusted).
Rust dependency
src-tauri/Cargo.toml
Added tauri-plugin-window-state = "2" to Cargo dependencies.
Plugin registration
src-tauri/src/lib.rs
Registered tauri_plugin_window_state::Builder::default().build() with the Tauri Builder.
Capabilities
src-tauri/capabilities/default.json
Added "window-state:default" permission to the main window's "permissions" array.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 I hopped through folds of code and light,
Saved windows snug through day and night,
Positions kept, sizes known,
A rabbit's patch, now safely grown,
Hooray for state remembered right! 🪟✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main feature being added: persisting window position and size across application restarts.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src-tauri/src/lib.rs`:
- Line 20: The tauri_plugin_window_state plugin is registered via
tauri_plugin_window_state::Builder::default().build() but the corresponding
capability is missing; open the capabilities JSON for the "default" capability
(identifier "default") and add "window-state:default" to the "permissions" array
so it includes
["core:default","notification:default","dialog:default","window-state:default"];
ensure the capability object still contains identifier "default", description,
and windows (e.g., "main") entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 98533d18-d290-470a-a747-48d8bca711e4

📥 Commits

Reviewing files that changed from the base of the PR and between 86ea2a6 and a2e4dde.

⛔ Files ignored due to path filters (5)
  • package-lock.json is excluded by !**/package-lock.json
  • src-tauri/Cargo.lock is excluded by !**/*.lock
  • src-tauri/gen/schemas/acl-manifests.json is excluded by !**/gen/**
  • src-tauri/gen/schemas/desktop-schema.json is excluded by !**/gen/**
  • src-tauri/gen/schemas/linux-schema.json is excluded by !**/gen/**
📒 Files selected for processing (3)
  • package.json
  • src-tauri/Cargo.toml
  • src-tauri/src/lib.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant