fix(desktop): Persist window size and position across restarts #2

Merged
herel merged 1 commits from desktop-window-size into main 2026-08-11 15:13:46 +00:00
Owner

Problem

The desktop window always reset to its default size (1024x768) after restart because no WindowState was persisted.

Root Cause

Main.kt created Window without WindowState or any persistence mechanism. Each launch used the default size.

Fix

  • WindowStateStorage (commonMain) — persists width/height/position via multiplatform-settings (java.util.prefs on desktop)
  • Main.kt (desktopMain) — loads saved state at startup via rememberWindowState(), uses snapshotFlow inside Window composition to persist changes continuously, explicit Preferences.flush() ensures values reach disk
  • Tests — 3 tests cover save/load/overwrite
  • Makefile — new desktop-install target to rebuild and copy app to /Applications/myicek.app
## Problem The desktop window always reset to its default size (1024x768) after restart because no WindowState was persisted. ## Root Cause Main.kt created Window without WindowState or any persistence mechanism. Each launch used the default size. ## Fix - WindowStateStorage (commonMain) — persists width/height/position via multiplatform-settings (java.util.prefs on desktop) - Main.kt (desktopMain) — loads saved state at startup via rememberWindowState(), uses snapshotFlow inside Window composition to persist changes continuously, explicit Preferences.flush() ensures values reach disk - Tests — 3 tests cover save/load/overwrite - Makefile — new desktop-install target to rebuild and copy app to /Applications/myicek.app
herel added 1 commit 2026-08-11 15:13:21 +00:00
The desktop window always reset to its default size after restart
because no WindowState was persisted. Add WindowStateStorage backed
by multiplatform-settings (java.util.prefs on desktop) to save and
restore width, height, and position. Use snapshotFlow inside the
Window composition to persist changes continuously, with an explicit
Preferences.flush() to ensure values reach disk before exit.

Also add 'desktop-install' Makefile target to rebuild and copy the
app to /Applications/myicek.app.
herel merged commit 22c0a61e32 into main 2026-08-11 15:13:46 +00:00
herel deleted branch desktop-window-size 2026-08-11 15:13:51 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: herel/myice-kmp#2