Skip to content

fix(window): persist window size + position across launches (#17) - #19

Merged
msitarzewski merged 1 commit into
mainfrom
fix/issue-17-window-state
May 31, 2026
Merged

msitarzewski merged 1 commit into
mainfrom
fix/issue-17-window-state

Conversation

@msitarzewski

Copy link
Copy Markdown
Owner

What

Registers tauri-plugin-window-state so the main window remembers its size and position between launches.

Resolves #17 — reported by @bytepl: resizing the window had no effect after a restart; it always reopened at the default size.

How

  • src-tauri/Cargo.toml — add tauri-plugin-window-state = "2" (resolves to 2.4.1)
  • src-tauri/src/lib.rs — register the plugin in the builder chain, right after the updater plugin
  • src-tauri/capabilities/default.json — add the window-state:default permission

The plugin hooks window move/resize/close events natively and writes geometry to a state file in the app config dir, restoring it on next launch. Default StateFlags cover size + position + maximized/fullscreen. No frontend wiring, no new IPC commands — registration is the whole feature.

The hardcoded 1100×720 in tauri.conf.json stays as the first-launch default, used only when no saved state exists.

Notes

The window is transparent: true + titleBarStyle: Overlay. The plugin restores geometry only — independent of the title-bar style — so the custom traffic-light position and the drag region (#8) are unaffected.

Verification

  • cargo check — exit 0
  • cargo test --lib — 585 passed, 0 failed (baseline unchanged)

🤖 Generated with Claude Code

Register tauri-plugin-window-state so the main window's geometry is saved
on move/resize and on exit, then restored on the next launch. Default
StateFlags cover size, position, and maximized/fullscreen. The hardcoded
1100x720 in tauri.conf.json stays as the first-launch default, used only
when no saved state exists.

No frontend wiring or new IPC commands -- the plugin hooks window events
natively, so registration is the whole feature.

Closes #17

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@msitarzewski
msitarzewski merged commit 5dc8fa1 into main May 31, 2026
cpiprint pushed a commit to cpiprint/brew-browser that referenced this pull request Sep 4, 2026
…eporter

Adds a staging release-notes file capturing the window-state persistence
fix (msitarzewski#17/msitarzewski#19) and crediting @bytepl as the reporter, following the
reporter-acknowledgment pattern from 0.3.1.md. Rename to the real version
file when the next release is cut.

Reported-by: Maciej Chojnacki (@bytepl)
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.

Window size is not saved between sessions

1 participant