From 4a927145af8895ccb011f0697dd7ff53f204e513 Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Sat, 19 Sep 2026 02:17:47 +0000 Subject: [PATCH] Show one settings section at a time --- .../Scene/SettingsSectionSlot.swift | 22 ++++++++++++++----- .../Scene/SettingsWindowScene+Sections.swift | 1 + .../Scene/SettingsWindowScene.swift | 1 + Sources/App/SettingsWindowFactory.swift | 4 ++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsSectionSlot.swift b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsSectionSlot.swift index bd92547c3974..3d82d884d621 100644 --- a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsSectionSlot.swift +++ b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsSectionSlot.swift @@ -13,6 +13,10 @@ import SwiftUI @MainActor struct SettingsSectionSlot: View { let section: SettingsSectionID + /// Only the selected pane is part of the hierarchy. Keeping inactive + /// sections out avoids constructing all settings controls at window open + /// and gives the window true one-pane-at-a-time behavior. + let isActive: Bool let isMounted: Bool /// `false` renders nothing while unmounted, for sections that hide /// themselves entirely (Cloud before it is available). @@ -23,12 +27,18 @@ struct SettingsSectionSlot: View { var body: some View { // The same spacing as the enclosing detail stack, so a section's // header and cards sit exactly where the flat stack put them. - VStack(alignment: .leading, spacing: 14) { - if isMounted { - content() - .onAppear { onMountedAppear() } - } else if showsPlaceholder { - SettingsSectionPlaceholder(section: section) + Group { + if isActive { + VStack(alignment: .leading, spacing: 14) { + if isMounted { + content() + .onAppear { onMountedAppear() } + } else if showsPlaceholder { + SettingsSectionPlaceholder(section: section) + } + } + } else { + EmptyView() } } .id("section:\(section.rawValue)") diff --git a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene+Sections.swift b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene+Sections.swift index 8f6ee56d5a61..0df8b77606be 100644 --- a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene+Sections.swift +++ b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene+Sections.swift @@ -167,6 +167,7 @@ extension SettingsWindowRoot { ) -> some View { SettingsSectionSlot( section: section, + isActive: section == selectedSection, isMounted: mountModel.isMounted(section), showsPlaceholder: section != .cloudMachines || isCloudSectionAvailable, onMountedAppear: { sectionContentDidAppear(section, proxy: proxy) }, diff --git a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene.swift b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene.swift index 9add975216b5..776b5e935703 100644 --- a/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene.swift +++ b/Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene.swift @@ -445,6 +445,7 @@ public struct SettingsWindowRoot: View { .onReceive(NotificationCenter.default.publisher(for: Self.navigationRequestName)) { notification in applyScrollNavigation(notification, proxy: proxy) } + .navigationTitle(selectedSection.title) } } } diff --git a/Sources/App/SettingsWindowFactory.swift b/Sources/App/SettingsWindowFactory.swift index 6f46f69a6116..4a16125017fa 100644 --- a/Sources/App/SettingsWindowFactory.swift +++ b/Sources/App/SettingsWindowFactory.swift @@ -56,6 +56,10 @@ enum SettingsWindowFactory { // the defaults is what produced the #8015 hybrid chrome. window.styleMask = [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView] window.title = String(localized: "settings.title", defaultValue: "Settings") + // Settings panes are not document windows: HIG guidance keeps the + // minimize and zoom controls visible but unavailable. + window.standardWindowButton(.miniaturizeButton)?.isEnabled = false + window.standardWindowButton(.zoomButton)?.isEnabled = false // [flexible space, sidebar toggle, sidebar tracking separator] is the // exact item layout the SwiftUI-owned 0.64.17 window built for its // NavigationSplitView: the toggle sits at the sidebar's trailing edge