Skip to content

Fix compact mode launch: window opens at wrong size when restoring saved state#113

Merged
WilliamsJason merged 1 commit intomainfrom
user/kush/fix-compact-mode-launch-state
Apr 6, 2026
Merged

Fix compact mode launch: window opens at wrong size when restoring saved state#113
WilliamsJason merged 1 commit intomainfrom
user/kush/fix-compact-mode-launch-state

Conversation

@dkushmerick
Copy link
Copy Markdown
Collaborator

Bug Fix: Compact Mode Launch State

Problem

When the app was closed in compact mode, \CompactModeProvider\ correctly restored \IsCompactMode = true\ from \settings.json. This caused \ApplyCompactMode\ to load \Sizes.Compact.xaml\ on startup — but the window always opened at its XAML-defined default dimensions (1200x800). The result was a full-size window with compact UI styles applied, producing a visually broken layout.

Fix

  • *\MainWindow.xaml.cs* — set \Width\ and \Height\ in the constructor (before \Show()\ is called) when compact mode is restored from settings. The window now opens at the correct dimensions immediately with no resize flash.
  • *\CompactModeProvider.cs* — cleaned up the now-redundant \SettingsKey\ constant and dead write path from the previous fix attempt (all persistence logic is restored correctly).

Before / After

Scenario Before After
Close compact, relaunch Full-size window + compact styles ❌ 600×420 window + compact styles ✅
Close normal, relaunch Full-size window + normal styles ✅ 1200×800 window + normal styles ✅

Fixes bug introduced in #112.

When the app was closed in compact mode, CompactModeProvider correctly
restored IsCompactMode=true from settings, causing ApplyCompactMode to
load Sizes.Compact.xaml. However, the window always opened at its
XAML-defined default dimensions (1200x800), producing a full-size window
with compact UI styles applied — a visual mismatch.

Fix:
- Restore the CompactModeProvider settings read (re-enables persistence)
- Set window Width/Height in the MainWindow constructor (before Show())
  so the window opens at the correct size immediately with no resize flash

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@WilliamsJason WilliamsJason merged commit c225bb1 into main Apr 6, 2026
7 checks passed
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.

3 participants