fix: remove settings sidebar toggle

This commit is contained in:
Peter Steinberger
2026-01-05 06:48:49 +01:00
parent 2c0f3a2887
commit 82c16a8bed
4 changed files with 73 additions and 92 deletions

View File

@@ -8,6 +8,7 @@ extension ConnectionsSettings {
self.detail
}
.navigationSplitViewStyle(.balanced)
.toolbar(removing: .sidebarToggle)
.onAppear {
self.store.start()
self.ensureSelection()

View File

@@ -18,32 +18,64 @@ struct SettingsRootView: View {
}
var body: some View {
NavigationSplitView {
List(selection: self.$selectedTab) {
Section("Settings") {
ForEach(self.sidebarTabs, id: \.self) { tab in
Label(tab.title, systemImage: tab.systemImage)
.tag(tab)
}
}
VStack(alignment: .leading, spacing: 12) {
if self.isNixMode {
self.nixManagedBanner
}
.listStyle(.sidebar)
.toolbar(removing: .sidebarToggle)
.frame(minWidth: 200, idealWidth: 220, maxWidth: 260)
} detail: {
VStack(alignment: .leading, spacing: 12) {
if self.isNixMode {
self.nixManagedBanner
TabView(selection: self.$selectedTab) {
GeneralSettings(state: self.state)
.tabItem { Label("General", systemImage: "gearshape") }
.tag(SettingsTab.general)
ConnectionsSettings()
.tabItem { Label("Connections", systemImage: "link") }
.tag(SettingsTab.connections)
VoiceWakeSettings(state: self.state)
.tabItem { Label("Voice Wake", systemImage: "waveform.circle") }
.tag(SettingsTab.voiceWake)
ConfigSettings()
.tabItem { Label("Config", systemImage: "slider.horizontal.3") }
.tag(SettingsTab.config)
InstancesSettings()
.tabItem { Label("Instances", systemImage: "network") }
.tag(SettingsTab.instances)
SessionsSettings()
.tabItem { Label("Sessions", systemImage: "clock.arrow.circlepath") }
.tag(SettingsTab.sessions)
CronSettings()
.tabItem { Label("Cron", systemImage: "calendar") }
.tag(SettingsTab.cron)
SkillsSettings(state: self.state)
.tabItem { Label("Skills", systemImage: "sparkles") }
.tag(SettingsTab.skills)
PermissionsSettings(
status: self.permissionMonitor.status,
refresh: self.refreshPerms,
showOnboarding: { OnboardingController.shared.show() })
.tabItem { Label("Permissions", systemImage: "lock.shield") }
.tag(SettingsTab.permissions)
if self.state.debugPaneEnabled {
DebugSettings(state: self.state)
.tabItem { Label("Debug", systemImage: "ant") }
.tag(SettingsTab.debug)
}
self.detailView(for: self.selectedTab)
AboutSettings(updater: self.updater)
.tabItem { Label("About", systemImage: "info.circle") }
.tag(SettingsTab.about)
}
.padding(.horizontal, 28)
.padding(.vertical, 22)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
}
.navigationSplitViewStyle(.balanced)
.navigationTitle("Settings")
.background(SettingsWindowChrome(title: "Clawdbot Settings"))
.padding(.horizontal, 28)
.padding(.vertical, 22)
.background(SettingsToolbarCleaner())
.frame(width: SettingsTab.windowWidth, height: SettingsTab.windowHeight, alignment: .topLeading)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.onReceive(NotificationCenter.default.publisher(for: .clawdbotSelectSettingsTab)) { note in
@@ -113,56 +145,6 @@ struct SettingsRootView: View {
return requested
}
private var sidebarTabs: [SettingsTab] {
var tabs: [SettingsTab] = [
.general,
.connections,
.voiceWake,
.config,
.instances,
.sessions,
.cron,
.skills,
.permissions,
]
if self.state.debugPaneEnabled {
tabs.append(.debug)
}
tabs.append(.about)
return tabs
}
@ViewBuilder
private func detailView(for tab: SettingsTab) -> some View {
switch tab {
case .general:
GeneralSettings(state: self.state)
case .connections:
ConnectionsSettings()
case .voiceWake:
VoiceWakeSettings(state: self.state)
case .config:
ConfigSettings()
case .instances:
InstancesSettings()
case .sessions:
SessionsSettings()
case .cron:
CronSettings()
case .skills:
SkillsSettings(state: self.state)
case .permissions:
PermissionsSettings(
status: self.permissionMonitor.status,
refresh: self.refreshPerms,
showOnboarding: { OnboardingController.shared.show() })
case .debug:
DebugSettings(state: self.state)
case .about:
AboutSettings(updater: self.updater)
}
}
@MainActor
private func refreshSnapshotPaths() async {
let paths = await GatewayConnection.shared.snapshotPaths()

View File

@@ -0,0 +1,18 @@
import AppKit
import SwiftUI
struct SettingsToolbarCleaner: NSViewRepresentable {
func makeNSView(context: Context) -> NSView {
NSView()
}
func updateNSView(_ nsView: NSView, context: Context) {
DispatchQueue.main.async {
guard let toolbar = nsView.window?.toolbar else { return }
toolbar.items.removeAll {
$0.itemIdentifier == .toggleSidebar
|| $0.itemIdentifier.rawValue == "com.apple.NSToolbarShowSidebarItem"
}
}
}
}

View File

@@ -1,20 +0,0 @@
import AppKit
import SwiftUI
struct SettingsWindowChrome: NSViewRepresentable {
let title: String
func makeNSView(context: Context) -> NSView {
NSView()
}
func updateNSView(_ nsView: NSView, context: Context) {
DispatchQueue.main.async {
guard let window = nsView.window else { return }
window.title = title
window.titleVisibility = .visible
window.toolbar?.isVisible = false
window.toolbarStyle = .unified
}
}
}