Skip to content

Restore modern Settings window chrome - #8015

Merged
austinywang merged 4 commits into
mainfrom
issue-8010-settings-titlebar-chrome
Jul 14, 2026
Merged

austinywang merged 4 commits into
mainfrom
issue-8010-settings-titlebar-chrome

Conversation

@austinywang

@austinywang austinywang commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Make the AppKit-owned SettingsWindowFactory establish the complete modern chrome contract at construction: full-size content, transparent hidden titlebar, no legacy separator, and unified-compact toolbar.
  • Install AppKit standard toggleSidebar toolbar chrome explicitly instead of assuming NSHostingController.sceneBridgingOptions will synthesize it.
  • Route the toolbar item and the existing Toggle Left Sidebar command through one shared request path into the SwiftUI NavigationSplitView state.

Root cause and architectural fix

PR #7783 correctly made AppKit the single lifecycle owner, but window chrome remained implicitly delegated to the hosted SwiftUI hierarchy. sceneBridgingOptions = [.toolbars, .title] forwards toolbar content explicitly declared by a hosted view; this Settings root declares navigation/search state but no toolbar content, so the AppKit factory returned a bare titled window.

The factory now owns the NSWindow chrome container and its standard AppKit toolbar, while SwiftUI continues to own navigation, sidebar visibility state, search, and Settings content. The invariant is established before makeSettingsWindow returns, independent of ordering or scene timing, without changing the synchronous construction, reuse/teardown, geometry, activation, or navigation-delivery guarantees from #7783/#7800.

Regression coverage

Two-commit red/green structure:

  1. 12dc775c4 adds SettingsWindowChromeTests only. It fails against the old factory because .fullSizeContentView, unified/transparent titlebar properties, and the toolbar are absent.
  2. 2a9733c2b implements the factory-owned chrome invariant.

The test asserts the constructed NSWindow contract, the standard sidebar toolbar item and target/action, and end-to-end delivery through the same sidebar-toggle notification used by the menu command. Pixel-level rendering of AppKit/SwiftUI chrome is not faked in unit coverage and remains a dogfood check.

Related issue #5071

This covers #5071s visible legacy-chrome complaint in the current architecture: the older SwiftUI Window path discussed there was removed by #7783, and the AppKit factory fixed here is now the only Settings construction path. This PR intentionally does not restore or modify the removed SwiftUI scene lifecycle.

Validation

  • scripts/check-pbxproj.sh
  • scripts/lint-pbxproj-test-wiring.sh
  • python3 scripts/check-package-resolved-policy.py
  • python3 scripts/check-workspace-package-groups.py --check
  • git diff --check
  • No local xcodebuild or XCUITest run, per issue task; app-target compilation and tests are delegated to CI.
  • python3 scripts/swift_file_length_budget.py was run. It reports nine pre-existing unrelated files over their checked-in budgets; this PR does not touch either budget TSV, and all touched Swift files remain below 500 lines.

Localization audit

No user-facing strings were added or changed. The toolbar uses AppKits standard NSToolbarItem.Identifier.toggleSidebar, including its system-localized label and accessibility description; the window title continues to use the existing localized settings.title key. No shortcuts, menus, schema text, docs, or locale catalogs changed.

Fixes #8010


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Restores modern Settings window chrome with full-size content, a transparent hidden titlebar, and an AppKit-owned unified-compact toolbar. Adds a standard sidebar toggle with routing that persists even when AppKit recreates the item; fixes #8010.

  • Bug Fixes
    • SettingsWindowFactory now builds chrome at construction: .fullSizeContentView, transparent/hidden titlebar, no separator, and .unifiedCompact toolbar. Bridges only .title. Creates an NSToolbar (identifier cmux.settings.toolbar) with .iconOnly display, no customization/autosave, inserts .toggleSidebar, and assigns it to the window.
    • SettingsHostWindow owns the toolbar contract: NSToolbarDelegate limits allowed/default items to .toggleSidebar, implements toggleSidebar: to call SettingsWindowPresenter.requestSidebarToggle(), and uses toolbarWillAddItem to configure every inserted standard item so target/action stay correct when AppKit recreates it. Added SettingsWindowChromeTests.

Written for commit 1d68eef. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Settings windows now use a unified, modern toolbar and title bar appearance.
    • Added a sidebar toggle control to the settings toolbar.
    • Sidebar visibility can be toggled directly from the toolbar.
  • Bug Fixes

    • Improved toolbar configuration and sidebar toggle action routing for more reliable settings navigation.
  • Tests

    • Added coverage verifying settings window appearance, toolbar configuration, and sidebar toggle behavior.

@vercel

vercel Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Jul 14, 2026 12:56am
cmux-staging Building Building Preview, Comment Jul 14, 2026 12:56am

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@austinywang, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 50c37735-fa9a-4c43-9c1f-43b3fd4b4e16

📥 Commits

Reviewing files that changed from the base of the PR and between d93011b and 1d68eef.

📒 Files selected for processing (2)
  • Sources/App/SettingsWindowFactory.swift
  • cmuxTests/SettingsWindowChromeTests.swift
📝 Walkthrough

Walkthrough

The Settings window now uses explicit AppKit unified chrome, including a transparent full-size titlebar and sidebar toolbar toggle. Toolbar actions route through SettingsWindowPresenter, with new tests covering styling, delegation, and action delivery.

Changes

Settings window chrome

Layer / File(s) Summary
Unified chrome configuration
Sources/App/SettingsWindowFactory.swift
Configures full-size content, titlebar appearance, toolbar identifiers, and the sidebar toggle item explicitly.
Sidebar toggle routing
Sources/App/SettingsWindowFactory.swift
Adds toolbar delegation and forwards the toggle action to SettingsWindowPresenter.requestSidebarToggle().
Chrome validation and test wiring
cmuxTests/SettingsWindowChromeTests.swift, cmuxTests/SettingsWindowNavigationRoutingTests.swift, cmux.xcodeproj/project.pbxproj
Adds serialized assertions for window and toolbar configuration, exposes the toggle recorder, and registers the new test source in the project.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 25
✅ Passed checks (25 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: restoring the modern Settings window chrome.
Description check ✅ Passed The description is detailed and covers summary, rationale, regression tests, validation, and related issues, with only optional template sections omitted.
Linked Issues check ✅ Passed The changes restore full-size content, unified toolbar chrome, and a working sidebar toggle as required by #8010.
Out of Scope Changes check ✅ Passed The added test, project wiring, and visibility tweak support the chrome fix and stay within the PR scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Cmux Swift Actor Isolation ✅ Passed Only main-actor UI code changed; no new Sendable/shared-mutable/background-access isolation mistakes were introduced.
Cmux Swift Blocking Runtime ✅ Passed PASS: No new blocking waits or locks appear in production Swift; only test-only Task.yield/Timer scaffolding is added under DEBUG tests.
Cmux Browser Automation Off-Main ✅ Passed Diff only touches Settings window chrome and tests; no browser.* socket commands, routing, WebKit/AppKit worker-lane changes, or policy-test gaps were introduced.
Cmux Expensive Synchronous Load ✅ Passed Diff only changes Settings window chrome and tests; no new RestorableAgentSessionIndex.load, JSON/JSONL parsing, or other heavy sync agent-history load on the main actor.
Cmux Cache Substitution Correctness ✅ Passed Diff only changes Settings window chrome/toolbar wiring; no persistence, history, undo, snapshot, or cache substitution path is touched.
Cmux No Hacky Sleeps ✅ Passed Changed files are Swift/test-only and add no fixed sleeps, timers-as-workarounds, asyncAfter, or polling.
Cmux Algorithmic Complexity ✅ Passed PASS: The only new scan is toolbar.items.first(where:) over a one-item, AppKit-owned toolbar; the rest is fixed-size chrome setup and test scaffolding.
Cmux Swift Concurrency ✅ Passed No new DispatchQueue/Combine/completion-handler/fire-and-forget Task patterns were added; the changed code stays synchronous and AppKit/XCTest callback-boundaries are allowed.
Cmux Swift @Concurrent ✅ Passed No diff introduces @concurrent, nonisolated async, or UI-isolated heavy async work; added code is synchronous/MainActor-bound and existing async helpers are unchanged.
Cmux Swift File And Package Boundaries ✅ Passed SettingsWindowFactory stays small (170 lines) and the change is focused AppKit/UI glue; added coverage is in tests, with no package-boundary breach.
Cmux Swiftpm Lockfiles ✅ Passed The PR only wires a new test file into project.pbxproj; it has no SwiftPM package-reference, .gitignore, workflow, or Package.resolved changes, so the lockfile rule isn’t violated.
Cmux Swift Logging ✅ Passed The PR diff adds no print/debugPrint/dump/NSLog/stdout logging; the existing Logger/fault call in SettingsWindowFactory is unchanged.
Cmux User-Facing Error Privacy ✅ Passed PASS: Diff only adds AppKit chrome/toolbar wiring and a test; no new user-facing errors, alerts, command output, or recovery copy expose implementation details.
Cmux Full Internationalization ✅ Passed No new user-facing text was introduced; the string keys were preexisting and already backed by translated xcstrings, and the rest is tests/comments/config identifiers.
Cmux Swiftui State Layout ✅ Passed Diff only adjusts AppKit-owned settings chrome and a test; no new ObservableObject/@published, GeometryReader, lazy-row, or render-time state mutation in SwiftUI.
Cmux Architecture Rethink ✅ Passed Adds required AppKit toolbar bridging while keeping one shared sidebar-toggle request path and a single SwiftUI owner for visibility state; no timing workaround.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed Settings already uses cmux.settings and is registered in cmuxAuxiliaryWindowIdentifiers; this PR only changes chrome/toolbar behavior, not close-shortcut ownership.
Cmux Source Artifacts ✅ Passed All changed paths are hand-written source/config/test files; no logs, screenshots, caches, build output, or scratch/artifact dirs appear in the PR diff.
Cmux No Test Or Debug Seam In Production Source ✅ Passed Sources/App/SettingsWindowFactory.swift adds only real AppKit chrome/toolbar behavior; no #if DEBUG or test/debug seam member was added to production source.
Cmux No Ambient Global State ✅ Passed No new file-scope funcs/vars or singletons were added; the PR only adds a static let and private helpers on an existing factory type, with test-only visibility tweaks.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8010-settings-titlebar-chrome

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR restores modern Settings window chrome under AppKit ownership. The main changes are:

  • Adds full-size content, a transparent hidden title bar, and unified compact toolbar styling.
  • Installs a delegate-backed standard sidebar toggle item.
  • Routes toolbar and menu actions through one sidebar-toggle request path.
  • Adds tests for the window chrome and live toolbar action.

Confidence Score: 5/5

This looks safe to merge.

  • The toolbar now has an explicit delegate and allowed/default item contract.
  • The live item is configured after attachment and routes through the shared action path.
  • Tests cover item retention, target assignment, and notification delivery.
  • No blocking issues remain in the changed code.

Important Files Changed

Filename Overview
Sources/App/SettingsWindowFactory.swift Defines the AppKit-owned window chrome, toolbar delegate contract, and shared sidebar-toggle route.
cmuxTests/SettingsWindowChromeTests.swift Checks the constructed chrome and verifies the live toolbar item's target and action delivery.
cmuxTests/SettingsWindowNavigationRoutingTests.swift Makes the test-target notification recorder reusable by the new chrome tests.
cmux.xcodeproj/project.pbxproj Wires the new Settings window chrome tests into the test target.

Reviews (3): Last reviewed commit: "fix: preserve live Settings toolbar rout..." | Re-trigger Greptile

Comment thread Sources/App/SettingsWindowFactory.swift
@austinywang
austinywang merged commit 85b8a53 into main Jul 14, 2026
29 checks passed
hhsw2015 pushed a commit to hhsw2015/cmux that referenced this pull request Jul 16, 2026
* test: cover Settings window chrome

* fix: restore modern Settings window chrome

* fix: define Settings toolbar item contract

* fix: preserve live Settings toolbar routing

(cherry picked from commit 85b8a53)

This branch was successfully deployed

1 active deployment
Preview – cmux — 1d68eef6 Deployed Jul 14, 2026 by vercel[bot]
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.

Settings window chrome regressed: bare legacy titlebar, no unified toolbar/sidebar toggle (AppKit-owned window, #7783)

1 participant