Skip to content

fix(windows): prevent Settings from auto-opening on launch#1022

Merged
datlechin merged 1 commit intomainfrom
fix/settings-auto-open
May 6, 2026
Merged

fix(windows): prevent Settings from auto-opening on launch#1022
datlechin merged 1 commit intomainfrom
fix/settings-auto-open

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

  • Settings window opened alongside Welcome on every launch after PR feat(windows): migrate Welcome, Connection Form, Integrations Activity to SwiftUI Window scenes #988 migrated Welcome / Connection Form / Integrations Activity to SwiftUI scenes
  • Root cause: Settings { ... } was the first scene in var body: some Scene, and SwiftUI on macOS 14/15 auto-launches the first declared scene even when it's a Settings scene — contrary to documentation. Compounding this, .background(SettingsNotificationBridge()) read @Environment(\.openSettings) from inside the Settings scene, which forced the scene to materialize during NSApplicationMain
  • Confirmed via window-lifecycle tracing with stack captures: at applicationDidFinishLaunching enter, the only window present was com_apple_SwiftUI_Settings_window opened by SwiftUI's runApp before user code ran

Fix

  • Reorder scenes: Window("Welcome", ...) first (default-launches), Settings { ... } last
  • Centralize Settings opening through WindowOpener.shared.openSettings(tab:) — wired via the existing WindowOpenerBridge inside the Welcome scene using \.openSettings
  • Delete the .openSettingsWindow notification round-trip and SettingsNotificationBridge; collapse 3 callsites onto the single WindowOpener.shared.openSettings(tab:) call
  • Convert WindowChromeConfigurator from an async Task (which ran after window creation) to a synchronous viewDidMoveToWindow hook on a private ChromeHostView subclass — isRestorable = false now lands before AppKit can encode restoration state, and the configurator is symmetric (toggling fullScreenable back on now removes .fullScreenNone)

Test plan

  • Cold launch with all caches cleared: only Welcome appears (verified via WindowOpenTracer stack-trace capture; Settings appears only on Cmd+,)
  • Cmd+, opens Settings as expected
  • Plugin-rejected dialog → "Open Plugin Settings" routes to Settings on plugins tab
  • iCloud sync chip in Welcome routes to Settings on account tab
  • Drop a .tableplugin on Finder → installs and opens Settings on plugins tab
  • Welcome window chrome (no miniaturize, no zoom, no fullscreen) still applied
  • swiftlint --strict on changed files: 0 violations
  • xcodebuild Debug arm64: BUILD SUCCEEDED

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin datlechin merged commit c782280 into main May 6, 2026
2 checks passed
@datlechin datlechin deleted the fix/settings-auto-open branch May 6, 2026 06:15
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