feat(windows): persist size + position across restarts via tauri-plugin-window-state

Without this, every secondary window (preview overlay, task float,
transcript viewer) opened at whatever spot Tauri / the compositor picked,
which was especially noticeable on Wayland where placement hints are
advisory. Main window's position was also lost on restart.

Registering tauri_plugin_window_state in the builder gives automatic
per-window-label save + restore. State lives in app-data/window-state.json;
fresh installs still fall back to the builder defaults (no changes to
inner_size on any of the four windows). Covers OpenWhispr issue #605 and
the broader UX pain.

No frontend changes — the plugin is purely backend. Regenerated ACL
manifests / desktop + linux schemas pick up the plugin registration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-21 09:38:23 +01:00
parent 11965a338b
commit 1f5309c8f5
5 changed files with 92 additions and 1 deletions

View File

@@ -128,6 +128,12 @@ pub fn run() {
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
.plugin(tauri_plugin_updater::Builder::new().build())
// Remember size + position of every window across app restarts.
// Without this, secondary windows (preview overlay, task float,
// transcript viewer) open at whatever spot the compositor picks,
// which feels random. State is persisted per-window-label to
// app-data/window-state.json.
.plugin(tauri_plugin_window_state::Builder::default().build())
.setup(|app| {
// Initialise database (blocking in setup — runs once at startup)
let db_path = database_path();