Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat: move app settings into a ChatGPT-style Settings window
leepokai35a0b7d7e042
diff --git a/apps/linux/src/dialogs.rs b/apps/linux/src/dialogs.rsindex d673a948..509ac354 100644--- a/apps/linux/src/dialogs.rs+++ b/apps/linux/src/dialogs.rs@@ -1172,7 +1172,7 @@ pub fn bot_menu(ui: &App, parent: >k::Widget, point: Option<(f64, f64)>, id: &ui::popup_menu(parent, point, items);}-/// The sidebar's Account panel: usage, this computer and its devices, the mobile app, help.+/// The sidebar's Account panel: usage, the mobile app, help and Settings.pub fn account_menu(ui: &App, anchor: >k::Button) {let open = |url: &'static str| -> Box<dyn Fn()> {Box::new(move || {@@ -1183,25 +1183,12 @@ pub fn account_menu(ui: &App, anchor: >k::Button) {);})};- let (ui2, ui3, ui4) = (ui.clone(), ui.clone(), ui.clone());+ let (ui2, ui3) = (ui.clone(), ui.clone());let items = vec![MenuItem::new("power-profile-balanced-symbolic","Usage",- Box::new(move || usage_sheet(&ui2)),- )- .chevron(),- MenuItem::new(- "computer-symbolic",- "Computers & devices",- Box::new(move || settings(&ui3)),- )- .chevron(),- // Host updates (check, install, automatic) live in Computers & devices.- MenuItem::new(- "software-update-available-symbolic",- "Check for updates",- Box::new(move || settings(&ui4)),+ Box::new(move || settings_page(&ui2, "usage")),).chevron(),MenuItem::new(@@ -1220,14 +1207,24 @@ pub fn account_menu(ui: &App, anchor: >k::Button) {"Report an issue",open("https://github.com/leepokai/codync/issues"),),+ // Computers & devices, usage and updates are pages of Settings.+ MenuItem::new(+ "emblem-system-symbolic",+ "Settings",+ Box::new(move || settings(&ui3)),+ )+ .divider(),];ui::popup_menu(anchor, None, items);}-/// Usage limits per provider (UsageSheet).-fn usage_sheet(ui: &App) {- let (dialog, view, _) = header_dialog("Usage", 520, 460);- let page = adw::PreferencesPage::new();+/// Settings' Usage page: limits per provider (`UsageLimits` on the Mac).+fn usage_page(ui: &App) -> adw::PreferencesPage {+ let page = adw::PreferencesPage::builder()+ .title("Usage")+ .icon_name("power-profile-balanced-symbolic")+ .name("usage")+ .build();let usage = adw::PreferencesGroup::new();let st = ui.state.borrow();let mut any = false;@@ -1264,8 +1261,7 @@ fn usage_sheet(ui: &App) {usage.add(&label("No usage information yet.", &["secondary"]));}page.add(&usage);- view.set_content(Some(&page));- dialog.present(Some(&ui.window));+ page}// MARK: settings & pairing@@ -1514,9 +1510,23 @@ fn host_updates_group(ui: &App) -> adw::PreferencesGroup {group}+/// Settings opened on its first page, Computers & devices.pub fn settings(ui: &App) {- let (dialog, view, _) = header_dialog("Computers & devices", 520, 720);- let page = adw::PreferencesPage::new();+ settings_page(ui, "computers");+}++/// Settings: Computers & devices, Usage and Updates as pages in a sidebar, like the Mac's.+pub fn settings_page(ui: &App, name: &str) {+ let dialog = adw::PreferencesDialog::builder()+ .title("Settings")+ .content_width(760)+ .content_height(640)+ .build();+ let page = adw::PreferencesPage::builder()+ .title("Computers")+ .icon_name("computer-symbolic")+ .name("computers")+ .build();let credentials = adw::PreferencesGroup::new();let button = gtk::Button::with_label("Credentials");let ui2 = ui.clone();@@ -1622,8 +1632,15 @@ pub fn settings(ui: &App) {});}page.add(&agents);+ dialog.add(&page);+ dialog.add(&usage_page(ui));- page.add(&host_updates_group(ui));+ let updates = adw::PreferencesPage::builder()+ .title("Updates")+ .icon_name("software-update-available-symbolic")+ .name("updates")+ .build();+ updates.add(&host_updates_group(ui));let about = adw::PreferencesGroup::new();about.add(&adw::ActionRow::builder()@@ -1635,8 +1652,9 @@ pub fn settings(ui: &App) {)).build(),);- page.add(&about);- view.set_content(Some(&page));+ updates.add(&about);+ dialog.add(&updates);+ dialog.set_visible_page_name(name);dialog.present(Some(&ui.window));}diff --git a/apps/linux/src/main.rs b/apps/linux/src/main.rsindex fbed4f1f..7dced416 100644--- a/apps/linux/src/main.rs+++ b/apps/linux/src/main.rs@@ -113,6 +113,9 @@ const CSS: &str = r#"@define-color accent_fg_color @cd_on_accent;@define-color accent_color @cd_text;switch:checked > slider { background: @cd_on_accent; }+/* Settings groups, like the Mac's CardSection: a filled rounded group, no outline. */+list.boxed-list { background: @cd_surface; box-shadow: none; border-radius: 16px; }+list.boxed-list > row { background: transparent; }window { font-size: 12px; }.surface { background: @cd_surface; }diff --git a/apps/macos/Views/ChatWindow.swift b/apps/macos/Views/ChatWindow.swiftindex 18504461..25845f82 100644--- a/apps/macos/Views/ChatWindow.swift+++ b/apps/macos/Views/ChatWindow.swift@@ -391,9 +391,9 @@ private struct ChatSplitView: View {@State private var previousSelection: BotReference?@State private var hoveredBot: BotReference?@State private var marketplace: ComputerID?- @State private var showComputers = false+ /// The Settings page open, nil while Settings is closed.+ @State private var settings: SettingsPage?@State private var search = ""- @State private var showUsage = false@State private var showAccount = false@State private var hoveredFooter: String?@FocusState private var searchFocused: Bool@@ -442,7 +442,7 @@ private struct ChatSplitView: View {VStack(spacing: 0) {HStack(spacing: 6) {Spacer(minLength: 0)- ComputerFilterHeader(accounts: accounts, hidden: $hiddenComputers) { showComputers = true }+ ComputerFilterHeader(accounts: accounts, hidden: $hiddenComputers) { settings = .computers }IconButton("New", systemImage: "plus") { newMenu.toggle() }.codyncMenu(isPresented: $newMenu, items: newItems).disabled(onlineStores.isEmpty)@@ -454,14 +454,12 @@ private struct ChatSplitView: View {.allowsHitTesting(!compact).accessibilityHidden(compact)if compact {- ComputerFilterHeader(accounts: accounts, hidden: $hiddenComputers, compact: true) { showComputers = true }+ ComputerFilterHeader(accounts: accounts, hidden: $hiddenComputers, compact: true) { settings = .computers }.frame(width: 70)}ScrollView {LazyVStack(spacing: 2) {if !compact {- // Other computers on older releases (this Mac's own host is the app's).- UpdateReminders(stores: stores.filter { shownIDs.contains($0.computer.id) })ForEach(stores.filter { shownIDs.contains($0.computer.id) }, id: \.computer.id) { store inif let mismatch = store.mismatch {UpdateNeededCard(store: store, mismatch: mismatch)@@ -590,37 +588,12 @@ private struct ChatSplitView: View {email: account.email,busy: account.isBusy,errorMessage: account.errorMessage ?? updates.errorMessage,- onSignIn: { provider in- dismissAccountMenu()- Task {- await account.signIn(provider: provider)- if account.errorMessage != nil {- withAnimation(Motion.fade) { showAccount = true }- }- }- },- onSignOut: {- dismissAccountMenu()- Task {- await host.signOut()- if account.errorMessage != nil {- withAnimation(Motion.fade) { showAccount = true }- }- }- },- compact: compact,+ onSignIn: { provider in dismissAccountMenu(); signIn(provider) },+ onSignOut: { dismissAccountMenu(); signOut() },approvals: host.approvals.count,- updateVersion: updates.availableVersion,- canUpdate: updates.canCheckForUpdates || updates.hasStagedUpdate,onDismiss: dismissAccountMenu,- onUsage: { dismissAccountMenu(); showUsage = true },- onComputers: { dismissAccountMenu(); showComputers = true },- onUpdate: { dismissAccountMenu(); updates.checkForUpdates() },- onToggleSidebar: {- dismissAccountMenu()- compact.toggle()- },- onSearch: { dismissAccountMenu(); compact = false; searchFocused = true }+ onUsage: { dismissAccountMenu(); settings = .usage },+ onSettings: { dismissAccountMenu(); settings = .general }).frame(width: min(260, windowSize.width - 32)).padding(.leading, 16)@@ -662,12 +635,10 @@ private struct ChatSplitView: View {.frame(width: min(920, windowSize.width - 80), height: sheetHeight)}}- .codyncSheet(isPresented: $showComputers) {- ComputersView()- .frame(width: 620, height: sheetHeight)- }- .codyncSheet(isPresented: $showUsage) {- UsageSheet().frame(width: 520)+ .codyncSheet(isPresented: Binding(get: { settings != nil }, set: { if !$0 { settings = nil } })) {+ SettingsView(page: settings ?? .general,+ onSignIn: signIn, onSignOut: signOut)+ .frame(width: min(800, windowSize.width - 80), height: min(620, sheetHeight))}.background {collapseButton.hidden()@@ -729,7 +700,7 @@ private struct ChatSplitView: View {} else if target == "plugins" {marketplace = host.store?.computer.id} else if target == "computers" {- showComputers = true+ settings = .computers} else if let target, let item = accounts.roster.first(where: { $0.bot.name == target }) {accounts.selection = item.ref}@@ -964,6 +935,24 @@ extension ChatSplitView {.help(compact ? "Expand sidebar" : "Collapse sidebar")}+ private func signIn(_ provider: AccountSession.SignInProvider) {+ Task {+ await account.signIn(provider: provider)+ if account.errorMessage != nil && settings == nil {+ withAnimation(Motion.fade) { showAccount = true }+ }+ }+ }++ private func signOut() {+ Task {+ await host.signOut()+ if account.errorMessage != nil && settings == nil {+ withAnimation(Motion.fade) { showAccount = true }+ }+ }+ }+private func dismissAccountMenu() {showAccount = falseprofileFocused = true@@ -1021,33 +1010,6 @@ extension ChatSplitView {}/// Usage per computer, read live from the stores.-private struct UsageSheet: View {- @Environment(HostController.self) private var host-- var body: some View {- let stores = host.accounts.computers.compactMap { host.accounts.store(for: $0.id) }- let withUsage = stores.filter { !$0.usage.providers.isEmpty }- VStack(alignment: .leading, spacing: 0) {- ModalHeader("Usage")- VStack(alignment: .leading, spacing: 20) {- if withUsage.isEmpty {- Text("No usage information yet.").foregroundStyle(Palette.secondary)- } else {- ForEach(withUsage, id: \.computer.id) { store in- if stores.count > 1 {- Label { Text(store.hostName) } icon: { ComputerBadge(store.computer, size: 16) }- .appFont(.headline)- }- UsageLimits(usage: store.usage)- }- }- }- .padding([.horizontal, .bottom], 24)- .padding(.top, 4)- }- }-}-extension View {@ViewBuilder fileprivate func hiddenWindowTitle() -> some View {if #available(macOS 15.0, *) { toolbar(removing: .title) } else { self }@@ -1063,17 +1025,10 @@ private struct SidebarAccountPanel: View {let errorMessage: String?let onSignIn: (AccountSession.SignInProvider) -> Voidlet onSignOut: () -> Void- let compact: Boollet approvals: Int- /// A release Sparkle found, waiting to be installed.- let updateVersion: String?- let canUpdate: Boollet onDismiss: () -> Voidlet onUsage: () -> Void- let onComputers: () -> Void- let onUpdate: () -> Void- let onToggleSidebar: () -> Void- let onSearch: () -> Void+ let onSettings: () -> Void@State private var page = "main"@State private var highlighted = 0@FocusState private var menuFocused: Bool@@ -1099,24 +1054,12 @@ private struct SidebarAccountPanel: View {Item(title: "Report an issue", icon: "bubble.left", chevron: true,action: { open("https://github.com/leepokai/codync/issues") })]- case "settings":- return [- Item(title: "Settings", icon: "chevron.left", action: { navigate("main") }),- Item(title: compact ? "Expand sidebar" : "Collapse sidebar", icon: "sidebar.left", action: onToggleSidebar),- Item(title: "Search bots", icon: "magnifyingglass", detail: "⌘F", action: onSearch)- ]default:return [Item(title: "Usage", icon: "gauge.with.dots.needle.33percent", chevron: true, action: onUsage),- Item(title: "Computers & devices", icon: "desktopcomputer",- detail: approvals > 0 ? "\(approvals)" : nil, chevron: true, action: onComputers),Item(title: "Get Codync for mobile", icon: "iphone", action: { open("https://apps.apple.com/app/id6760984418") }),Item(title: "Support", icon: "book.closed", chevron: true, action: { navigate("support") }),- Item(title: "Settings", icon: "gearshape", action: { navigate("settings") }),- Item(title: updateVersion.map { "Update to \($0)" } ?? "Check for updates", icon: "arrow.down.circle",- detail: updateVersion == nil ? Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String : nil,- disabled: !canUpdate, action: onUpdate),- Item(title: compact ? "Expand sidebar" : "Collapse sidebar", icon: "sidebar.left", action: onToggleSidebar)+ Item(title: "Settings", icon: "gearshape", detail: approvals > 0 ? "\(approvals)" : nil, action: onSettings)] + authenticationItems}}@@ -1167,8 +1110,8 @@ private struct SidebarAccountPanel: View {}@ViewBuilder private func menuRow(_ item: Item, index: Int) -> some View {- if index == (page == "main" ? 6 : 1) { divider }- if page == "main" && index == 7 { accountIdentity }+ if index == (page == "main" ? 4 : 1) { divider }+ if page == "main" && index == 4 { accountIdentity }AccountPanelRow(title: item.title, icon: item.icon, assetIcon: item.assetIcon, detail: item.detail,chevron: item.chevron, keyboardFocused: highlighted == index, action: item.action).disabled(item.disabled)diff --git a/apps/macos/Views/ComputersView.swift b/apps/macos/Views/ComputersView.swiftindex 9e70ef47..91a08279 100644--- a/apps/macos/Views/ComputersView.swift+++ b/apps/macos/Views/ComputersView.swift@@ -113,6 +113,8 @@ struct ApprovalSheet: View {/// Computers this Mac manages (itself and SSH), with their account, relay and authorized devices;/// SSH profiles; and the account's other computers.struct ComputersView: View {+ /// False inside the Settings window, which titles the page itself.+ var showsHeader = true@Environment(HostController.self) private var host@Environment(AccountSession.self) private var account@State private var editingSSH: SSHProfile?@@ -120,17 +122,17 @@ struct ComputersView: View {var body: some View {VStack(spacing: 0) {- ModalHeader("Computers & devices")+ if showsHeader { ModalHeader("Computers & devices") }ScrollView {- VStack(alignment: .leading, spacing: 22) {+ VStack(alignment: .leading, spacing: 26) {ForEach(host.managedStores, id: \.computer.id) { store inManagedComputerCard(store: store, ssh: host.isSSH(store.computer.id))}sshSectionaccountSection}- .padding(.horizontal, 20)- .padding(.top, 4)+ .padding(.horizontal, showsHeader ? 20 : 14)+ .padding(.top, showsHeader ? 4 : 14).padding(.bottom, 20)}}@@ -145,7 +147,7 @@ struct ComputersView: View {}private var sshSection: some View {- VStack(alignment: .leading, spacing: 8) {+ VStack(alignment: .leading, spacing: 0) {HStack {SectionTitle("Over SSH")Spacer()@@ -153,6 +155,7 @@ struct ComputersView: View {editingSSH = SSHProfile(host: "", name: "")}}+ .sectionHeader()if host.ssh.profiles.isEmpty {Text("Run bots on another computer you reach with SSH. It needs codync-host installed; your SSH keys stay on this Mac.").appFont(.callout)@@ -169,7 +172,7 @@ struct ComputersView: View {let managed = Set(host.managedStores.map(\.computer.id))let reached = host.accounts.computers.filter { !managed.contains($0.id) }let others = host.accounts.cloudComputers.filter { c in !managed.contains(c.id) && !reached.contains { $0.id == c.id } }- VStack(alignment: .leading, spacing: 8) {+ VStack(alignment: .leading, spacing: 0) {HStack {SectionTitle("In your account")Spacer()@@ -177,12 +180,16 @@ struct ComputersView: View {IconButton("Refresh", systemImage: "arrow.clockwise") { Task { await host.accounts.refreshCloud() } }}}- if !account.isSignedIn {- Text("Sign in to reach the other computers in your account from this Mac.")- .appFont(.callout).foregroundStyle(Palette.secondary)- } else if reached.isEmpty && others.isEmpty {- Text("No other computers in your account yet.").appFont(.callout).foregroundStyle(Palette.secondary)+ .sectionHeader()+ Group {+ if !account.isSignedIn {+ Text("Sign in to reach the other computers in your account from this Mac.")+ } else if reached.isEmpty && others.isEmpty {+ Text("No other computers in your account yet.")+ }}+ .appFont(.callout)+ .foregroundStyle(Palette.secondary)ForEach(reached) { computer inif let store = host.accounts.store(for: computer.id) {HStack(spacing: 10) {@@ -210,7 +217,7 @@ private struct SectionTitle: View {let title: Stringinit(_ title: String) { self.title = title }var body: some View {- Text(title).appFont(.headline).foregroundStyle(Palette.text).accessibilityAddTraits(.isHeader)+ Text(title).appFont(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.text).accessibilityAddTraits(.isHeader)}}@@ -276,6 +283,7 @@ private struct ManagedComputerCard: View {@State private var devices: [AuthorizedDevice]?@State private var busy = false@State private var showPairing = false+ @State private var showVoice = false@State private var confirmRevoke: AuthorizedDevice?@State private var confirmUnclaim = false@State private var confirmAutoApproval = false@@ -285,57 +293,63 @@ private struct ManagedComputerCard: View {private var autoApproval: Bool { cloud?.approval == .auto }var body: some View {- VStack(alignment: .leading, spacing: 12) {- HStack(spacing: 10) {- ComputerBadge(store.computer, size: 26)- VStack(alignment: .leading, spacing: 1) {- Text(store.hostName).appFont(.headline)- Text(ssh ? "Over SSH · \(store.statusText)" : "This Mac · \(store.statusText)")- .appFont(.caption).foregroundStyle(Palette.secondary)- }- Spacer()- IconButton("Pair iPhone", systemImage: "qrcode", selected: showPairing) { showPairing.toggle() }- .disabled(store.connection != .online)- .codyncSheet(isPresented: $showPairing) {- VStack(spacing: 0) {- ModalHeader("Pair iPhone with \(store.hostName)")- PairingPanel(store: store)- }- .frame(width: 340)+ VStack(alignment: .leading, spacing: 28) {+ CardSection {+ HStack(spacing: 10) {+ ComputerBadge(store.computer, size: 26)+ VStack(alignment: .leading, spacing: 1) {+ Text(store.hostName).appFont(.headline)+ Text(ssh ? "Over SSH · \(store.statusText)" : "This Mac · \(store.statusText)")+ .appFont(.caption).foregroundStyle(Palette.secondary)}- }-- Toggle(isOn: Binding(get: { cloud?.enabled ?? false }, set: { on in run { await host.setCloud(store, enabled: on) } })) {- VStack(alignment: .leading, spacing: 1) {- Text("Reach from anywhere")- Text(cloudLine).appFont(.caption).foregroundStyle(cloud?.lastError == nil ? Palette.secondary : Palette.warning)+ Spacer()+ if ssh {+ // This Mac's voice settings are their own Settings page.+ IconButton("Voice chat", systemImage: "waveform", selected: showVoice) { showVoice.toggle() }+ .disabled(store.connection != .online)+ .codyncSheet(isPresented: $showVoice) { VoiceChatSettingsView().environment(store) }+ }+ IconButton("Pair iPhone", systemImage: "qrcode", selected: showPairing) { showPairing.toggle() }+ .disabled(store.connection != .online)+ .codyncSheet(isPresented: $showPairing) {+ VStack(spacing: 0) {+ ModalHeader("Pair iPhone with \(store.hostName)")+ PairingPanel(store: store)+ }+ .frame(width: 340)+ }}- }- .toggleStyle(.codync)- .disabled(busy || store.connection != .online)-- accountLine- if cloud?.owner != nil {- Toggle(isOn: Binding(get: { autoApproval }, set: { on in- if on { confirmAutoApproval = true } else { setApproval(.code) }- })) {+ Toggle(isOn: Binding(get: { cloud?.enabled ?? false }, set: { on in run { await host.setCloud(store, enabled: on) } })) {VStack(alignment: .leading, spacing: 1) {- Text("Skip the 6-digit check")- Text(autoApproval ? "Devices on your account get in on their own." : "Each new device shows a code you approve here.")- .appFont(.caption).foregroundStyle(autoApproval ? Palette.warning : Palette.secondary)+ Text("Reach from anywhere")+ Text(cloudLine).appFont(.caption).foregroundStyle(cloud?.lastError == nil ? Palette.secondary : Palette.warning)}}.toggleStyle(.codync).disabled(busy || store.connection != .online)- .transition(.opacity)- }- VStack(alignment: .leading, spacing: 6) {- Text("Devices that can use \(store.hostName)").appFont(.subheadline.weight(.semibold))+ accountLine++ if cloud?.owner != nil {+ Toggle(isOn: Binding(get: { autoApproval }, set: { on in+ if on { confirmAutoApproval = true } else { setApproval(.code) }+ })) {+ VStack(alignment: .leading, spacing: 1) {+ Text("Skip the 6-digit check")+ Text(autoApproval ? "Devices on your account get in on their own." : "Each new device shows a code you approve here.")+ .appFont(.caption).foregroundStyle(autoApproval ? Palette.warning : Palette.secondary)+ }+ }+ .toggleStyle(.codync)+ .disabled(busy || store.connection != .online)+ .transition(.opacity)+ }+ }+ CardSection("Devices that can use \(store.hostName)") {if let devices {if devices.isEmpty {- Text("None yet. Pair an iPhone, or approve one from your account.").appFont(.caption).foregroundStyle(Palette.secondary)+ Text("None yet. Pair an iPhone, or approve one from your account.").foregroundStyle(Palette.secondary)}ForEach(devices) { device in deviceRow(device).transition(.opacity.combined(with: .move(edge: .top))) }} else {@@ -343,7 +357,6 @@ private struct ManagedComputerCard: View {}}}- .card().animation(Motion.reduced(Motion.layout, reduceMotion), value: devices?.map(\.key)).animation(Motion.reduced(Motion.layout, reduceMotion), value: cloud?.owner == nil).task(id: "\(store.computer.id)/\(store.connection == .online)/\(store.accessRequests.count)") { await loadDevices() }@@ -410,7 +423,7 @@ private struct ManagedComputerCard: View {.foregroundStyle(Palette.secondary).accessibilityHidden(true)VStack(alignment: .leading, spacing: 1) {- Text(device.name).appFont(.callout)+ Text(device.name)Text(detail(device)).appFont(.caption).foregroundStyle(Palette.tertiary)}Spacer()@@ -628,10 +641,17 @@ private struct SSHProfileEditor: View {}private extension View {+ /// A section's title row (the CardSection heading).+ func sectionHeader() -> some View {+ frame(minHeight: 24).padding(.leading, 2).padding(.bottom, 10)+ }++ /// One filled group, like a CardSection's.func card() -> some View {- padding(12)+ padding(16).frame(maxWidth: .infinity, alignment: .leading)- .background(Palette.surface, in: RoundedRectangle(cornerRadius: 12, style: .continuous))+ .background(Palette.surface, in: RoundedRectangle(cornerRadius: 16, style: .continuous))+ .padding(.bottom, 8)}}diff --git a/apps/macos/Views/SettingsView.swift b/apps/macos/Views/SettingsView.swiftnew file mode 100644index 00000000..296a6606--- /dev/null+++ b/apps/macos/Views/SettingsView.swift@@ -0,0 +1,265 @@+import CodyncKit+import CodyncUI+import SwiftUI++/// The chat window's Settings: pages in a sidebar, ChatGPT's settings layout+/// (`docs/design/reference/chatgpt-settings-*.png`).+enum SettingsPage: String, CaseIterable, Identifiable {+ case general, computers, voice, usage, updates++ var id: Self { self }++ var title: String {+ switch self {+ case .general: "General"+ case .computers: "Computers & devices"+ case .voice: "Voice chat"+ case .usage: "Usage"+ case .updates: "Updates"+ }+ }++ /// The sidebar's label, short enough for its width.+ var label: String { self == .computers ? "Computers" : title }++ /// The sidebar group it's listed under.+ var group: String {+ switch self {+ case .general, .voice, .usage: "Personal"+ case .computers, .updates: "This Mac"+ }+ }++ var icon: String {+ switch self {+ case .general: "gearshape"+ case .computers: "desktopcomputer"+ case .voice: "waveform"+ case .usage: "gauge.with.dots.needle.33percent"+ case .updates: "arrow.down.circle"+ }+ }+}++struct SettingsView: View {+ /// Kept here: the sheet's content doesn't follow the window's state once shown.+ @State private var page: SettingsPage+ let onSignIn: (AccountSession.SignInProvider) -> Void+ let onSignOut: () -> Void++ init(page: SettingsPage,+ onSignIn: @escaping (AccountSession.SignInProvider) -> Void, onSignOut: @escaping () -> Void) {+ _page = State(initialValue: page)+ self.onSignIn = onSignIn+ self.onSignOut = onSignOut+ }+ @Environment(HostController.self) private var host+ @Environment(\.dismissModal) private var dismiss+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ var body: some View {+ HStack(spacing: 0) {+ sidebar+ Rectangle().fill(Palette.border).frame(width: 1)+ VStack(alignment: .leading, spacing: 0) {+ Text(page.title)+ .appFont(.system(size: 24, weight: .semibold))+ .foregroundStyle(Palette.text)+ .padding(.horizontal, 32)+ .padding(.top, 30)+ .padding(.bottom, 8)+ content+ .padding(.horizontal, 18)+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)+ .id(page)+ .transition(.opacity)+ }+ }+ .overlay(alignment: .topTrailing) {+ IconButton("Close", systemImage: "xmark") { dismiss() }+ .keyboardShortcut(.cancelAction)+ .padding(14)+ }+ .background(Palette.background)+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: page)+ }++ private var sidebar: some View {+ VStack(alignment: .leading, spacing: 2) {+ ForEach(["Personal", "This Mac"], id: \.self) { group in+ Text(group)+ .appFont(.system(size: 12, weight: .medium))+ .foregroundStyle(Palette.tertiary)+ .padding(.horizontal, 10)+ .padding(.top, group == "Personal" ? 0 : 16)+ .padding(.bottom, 4)+ ForEach(SettingsPage.allCases.filter { $0.group == group }) { item in+ sidebarItem(item)+ }+ }+ Spacer()+ }+ .padding(10)+ .padding(.top, 20)+ .frame(width: 200)+ }++ private func sidebarItem(_ item: SettingsPage) -> some View {+ Button { page = item } label: {+ HStack(spacing: 10) {+ Image(systemName: item.icon).frame(width: 18).foregroundStyle(Palette.secondary)+ Text(item.label).lineLimit(1)+ Spacer(minLength: 4)+ if item == .computers && !host.approvals.isEmpty {+ Text("\(host.approvals.count)").appFont(.system(size: 11, weight: .semibold)).foregroundStyle(Palette.secondary)+ }+ }+ .appFont(.system(size: 13))+ .foregroundStyle(Palette.text)+ .padding(.horizontal, 10)+ .frame(height: 32)+ .background(item == page ? Palette.text.opacity(0.08) : .clear, in: RoundedRectangle(cornerRadius: 10, style: .continuous))+ .contentShape(Rectangle())+ }+ .buttonStyle(.plain)+ .accessibilityAddTraits(item == page ? .isSelected : [])+ }++ @ViewBuilder private var content: some View {+ switch page {+ case .general: GeneralSettings(onSignIn: onSignIn, onSignOut: onSignOut)+ case .computers: ComputersView(showsHeader: false)+ case .voice:+ if let store = host.store {+ VoiceChatSettingsView(showsHeader: false).environment(store)+ } else {+ CardForm {+ Text("Voice keys are kept by this Mac's host, which isn't running.").foregroundStyle(Palette.secondary)+ }+ }+ case .usage: CardForm { UsageLimitsList() }+ case .updates: UpdateSettings()+ }+ }+}++/// Account, window and app preferences.+private struct GeneralSettings: View {+ let onSignIn: (AccountSession.SignInProvider) -> Void+ let onSignOut: () -> Void+ @Environment(HostController.self) private var host+ @Environment(AccountSession.self) private var account+ @AppStorage("sidebarCompact") private var compact = false+ @AppStorage(ConversationTypography.preferenceKey) private var fontSize = ConversationTypography.defaultSize+ @AppStorage(SharedStore.usageIconStyleKey, store: UserDefaults(suiteName: SharedStore.appGroup))+ private var usageIconStyle = UsageIconStyle.character.rawValue++ var body: some View {+ CardForm {+ CardSection("Account", footer: account.errorMessage) {+ HStack(spacing: 10) {+ Image(systemName: "person.crop.circle")+ .appFont(.system(size: 26))+ .foregroundStyle(Palette.secondary)+ .accessibilityHidden(true)+ VStack(alignment: .leading, spacing: 1) {+ Text(account.isSignedIn ? (account.email ?? "Signed in") : "Not signed in").lineLimit(1)+ Text(account.isSignedIn ? "Reach your computers from anywhere" : "Sign in to reach your computers from anywhere")+ .appFont(.caption).foregroundStyle(Palette.secondary)+ }+ Spacer(minLength: 8)+ if account.isSignedIn {+ Button(account.isBusy ? "Please wait…" : "Sign out", action: onSignOut)+ .buttonStyle(.secondary)+ .disabled(account.isBusy)+ } else {+ Button("Apple") { onSignIn(.apple) }.buttonStyle(.secondary).disabled(account.isBusy)+ Button("Google") { onSignIn(.google) }.buttonStyle(.secondary).disabled(account.isBusy)+ }+ }+ }+ CardSection("Appearance") {+ ValueRow("Text size") {+ ChoicePicker(selection: $fontSize, options: ConversationTypography.sizes.map { size in+ (size, size == ConversationTypography.defaultSize ? "\(Int(size)) pt (Default)" : "\(Int(size)) pt")+ })+ }+ ValueRow("Usage icons") {+ ChoicePicker(selection: $usageIconStyle, options: [+ (UsageIconStyle.character.rawValue, "Character"), (UsageIconStyle.original.rawValue, "Original"),+ ])+ }+ Toggle("Compact sidebar", isOn: $compact).toggleStyle(.codync)+ }+ CardSection("System") {+ Toggle("Open at login", isOn: Binding(get: { host.launchAtLogin }, set: { host.setLaunchAtLogin($0) }))+ .toggleStyle(.codync)+ }+ }+ }+}++/// Every computer's usage limits, grouped by computer when there's more than one.+struct UsageLimitsList: View {+ @Environment(HostController.self) private var host++ var body: some View {+ let stores = host.accounts.computers.compactMap { host.accounts.store(for: $0.id) }+ let withUsage = stores.filter { !$0.usage.providers.isEmpty }+ if withUsage.isEmpty {+ Text("No usage information yet.").foregroundStyle(Palette.secondary)+ } else {+ ForEach(withUsage, id: \.computer.id) { store in+ if stores.count > 1 {+ Label { Text(store.hostName) } icon: { ComputerBadge(store.computer, size: 16) }+ .appFont(.headline)+ }+ UsageLimits(usage: store.usage)+ }+ }+ }+}++/// Sparkle's update check and preferences, the same as the menu bar's Updates menu.+private struct UpdateSettings: View {+ @Environment(UpdatesManager.self) private var updates++ var body: some View {+ @Bindable var updates = updates+ CardForm {+ CardSection("Codync", footer: footer) {+ ValueRow("Version", detail: updates.lastUpdateCheckDate.map { "Last checked \($0.formatted(date: .abbreviated, time: .shortened))" }) {+ HStack(spacing: 10) {+ Text(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "")+ Button(updates.availableVersion.map { "Update to \($0)" } ?? "Check for updates") {+ updates.checkForUpdates()+ }+ .buttonStyle(.secondary)+ .disabled(!updates.canCheckForUpdates && !updates.hasStagedUpdate)+ }+ }+ Toggle("Automatically check for updates", isOn: $updates.automaticallyChecksForUpdates)+ .toggleStyle(.codync)+ .disabled(!updates.isSupported)+ Toggle("Automatically download and install", isOn: $updates.automaticallyDownloadsUpdates)+ .toggleStyle(.codync)+ .disabled(!updates.isSupported)+ if let error = updates.errorMessage {+ HStack {+ Text(error).foregroundStyle(Palette.warning).fixedSize(horizontal: false, vertical: true)+ Spacer(minLength: 8)+ Button("Retry") { updates.retryInstallation() }+ .buttonStyle(.secondary)+ .disabled(updates.preparingInstallation)+ }+ }+ }+ }+ }++ private var footer: String? {+ if !updates.isSupported { return "Updates are available in release builds." }+ if let app = updates.waitingForApp { return "Waiting for iPhone app \(app) to pass App Store review." }+ return nil+ }+}diff --git a/docs/design/reference/chatgpt-settings-data.png b/docs/design/reference/chatgpt-settings-data.pngnew file mode 100644index 00000000..eda64bb5Binary files /dev/null and b/docs/design/reference/chatgpt-settings-data.png differdiff --git a/docs/design/reference/chatgpt-settings-general-light.png b/docs/design/reference/chatgpt-settings-general-light.pngnew file mode 100644index 00000000..0bbc2975Binary files /dev/null and b/docs/design/reference/chatgpt-settings-general-light.png differdiff --git a/docs/design/reference/chatgpt-settings-general.png b/docs/design/reference/chatgpt-settings-general.pngnew file mode 100644index 00000000..6253b211Binary files /dev/null and b/docs/design/reference/chatgpt-settings-general.png differdiff --git a/docs/design/ui-conventions.md b/docs/design/ui-conventions.mdindex e4bf3d2f..6516635b 100644--- a/docs/design/ui-conventions.md+++ b/docs/design/ui-conventions.md@@ -8,16 +8,16 @@ The conversation keeps the native glass buttons over the chat with a soft top scDo not wrap those toolbar controls in `IconButtonStyle`, hand-sized rounded backgrounds or another glass effect. The account avatar is toolbar content, with the system supplying the enclosing surface. This is the explicit exception to the custom-chrome rule below.-Connecting and reconnecting are background work. `BotStore` gives initial offline reports 1 second to recover and holds drops from online (including relay "computer offline" reports) for 5 seconds. "No access" shows immediately. Automatic read acknowledgements never open an error dialog and visible conversations are acknowledged again after reconnecting. An action taken during a reconnect (back in the foreground, a new network, a drop still inside its grace) waits for the link, up to 20 seconds, instead of failing; while one waits, headers read `Connecting…` and the conversation's connection label shows a spinner. Calls that are safe to repeat (send, stop, approvals, pin, hide, mark as read, delete) are tried again when the link drops under them. Tapping while the header says Offline because the computer can't be reached starts a fresh connection attempt and waits for it, instead of failing until the backoff gets there; a computer the relay reports as off fails at once, since the relay says when it is back. A permission card shows a spinner on the chosen option, dims the others and takes no second answer until the computer has it. The Linux app and the TUI follow the same rule over loopback: a command the host can't be reached for is retried for up to 20 seconds behind their "Reconnecting…" indicator (the `hello` probe that explains an unreachable host still answers at once), and their permission cards spin on the chosen option. The "Something went wrong" dialog is left for a computer that is off, a refused device, the computer's own answers, and reconnects that outlast the wait. Background work (cloud refresh, device registration, automatic access requests) logs connection, busy-cloud and stale-token failures instead of showing them. The iOS app disconnects only in `.background`, not `.inactive`. Connection status lives only in headers and their menus. The roster header shows a small summary (`1 connected`, `1/2 connected`, `2 offline`, or `Connecting…`). Its computer menu supports multiple selections, Show only, All computers, reconnect, and management. At least one available computer stays selected; if saved exclusions would hide every computer, the list falls back to all. Filters persist on the device. Bots sort pinned first, then by recency. On iPhone, when more than one computer is shown, each computer gets a light heading (badge, name, connection, and "No bots yet" when empty) above its own bots; with one computer the list stays flat. Long-press a heading and drag it onto another computer's section to reorder computers (VoiceOver: Move up / Move down); the order is saved on the device (`AccountStore.move`). The Mac shows a flat roster. There are no connection banners. The compact Mac rail uses a computer icon for the same menu. Conversation headers show a small connection label, with the computer name available in the header menu or help text. Pull-to-refresh remains available on iPhone. Computer setup and access requests live under Manage computers.+Connecting and reconnecting are background work. `BotStore` gives initial offline reports 1 second to recover and holds drops from online (including relay "computer offline" reports) for 5 seconds. "No access" shows immediately. Automatic read acknowledgements never open an error dialog and visible conversations are acknowledged again after reconnecting. An action taken during a reconnect (back in the foreground, a new network, a drop still inside its grace) waits for the link, up to 20 seconds, instead of failing; while one waits, headers read `Connecting…` and the conversation's connection label shows a spinner. Calls that are safe to repeat (send, stop, approvals, pin, hide, mark as read, delete) are tried again when the link drops under them. Tapping while the header says Offline because the computer can't be reached starts a fresh connection attempt and waits for it, instead of failing until the backoff gets there; a computer the relay reports as off fails at once, since the relay says when it is back. A permission card shows a spinner on the chosen option, dims the others and takes no second answer until the computer has it. The Linux app and the TUI follow the same rule over loopback: a command the host can't be reached for is retried for up to 20 seconds behind their "Reconnecting…" indicator (the `hello` probe that explains an unreachable host still answers at once), and their permission cards spin on the chosen option. The "Something went wrong" dialog is left for a computer that is off, a refused device, the computer's own answers, and reconnects that outlast the wait. Background work (cloud refresh, device registration, automatic access requests) logs connection, busy-cloud and stale-token failures instead of showing them. The iOS app disconnects only in `.background`, not `.inactive`. Connection status lives only in headers and their menus. The roster header shows a small summary (`1 connected`, `1/2 connected`, `2 offline`, or `Connecting…`). Its computer menu supports multiple selections, Show only, All computers, reconnect, and management. At least one available computer stays selected; if saved exclusions would hide every computer, the list falls back to all. Filters persist on the device. Bots sort pinned first, then by recency. On iPhone, when more than one computer is shown, each computer gets a light heading (badge, name, connection, and "No bots yet" when empty) above its own bots; with one computer the list stays flat. Tapping a heading folds that computer's bots away (chevron; saved on the device). Long-press a heading to lift the whole section and drag it up or down; the other sections slide out of its way and the order is saved on the device on release (`AccountStore.move`; VoiceOver: Move up / Move down). The Mac shows a flat roster. There are no connection banners. The compact Mac rail uses a computer icon for the same menu. Conversation headers show a small connection label, with the computer name available in the header menu or help text. Pull-to-refresh remains available on iPhone. Computer setup and access requests live under Manage computers.Sources: `apps/ios/Views/BotListView.swift`, `AccountSwitcherView.swift`, `kit/Sources/CodyncUI/Thread/ThreadView.swift`, `Bots/ComputerFilterHeader.swift`, `Store/ComputerSelection.swift`, `Bots/BotRow.swift`.## macOS menu barRelease update controls live in the native Settings → Updates menu; the chat-window's account menu repeats the one action (**Check for updates**, which becomes-**Update to <version>** once a release is found). GTK's account menu opens Host-updates in Computers & devices and the TUI action list has **Check for updates**.+window's Settings has the same controls on its Updates page (**Check for updates**,+which becomes **Update to <version>** once a release is found). GTK's Settings has+Host updates on its Updates page and the TUI action list has **Check for updates**.Sparkle's standard update/install windows are a native system-integration exception; keepsignature errors, progress and relaunch in its supported user driver.@@ -26,7 +26,11 @@ Use `MenuBarExtra` with `.menuBarExtraStyle(.menu)`. Its commands, submenus, cheThe menu retains host installation/restart, bot conversation/stop actions, approval review, usage limits, remote-screen permissions, launch-at-login and quit. Pairing opens a separate titled window because its QR needs a persistent scanning surface. The chat window retains its own UI conventions.Usage limits appear directly in the top-level menu, grouped by provider with native section headers. Show each window's percentage, reset time when available, and the provider's last update; do not hide them in submenus. The account menu's-Usage row shows no number; its sheet lists the same per-provider bars (`UsageLimits`).+Usage row shows no number; it opens Settings' Usage page with the same per-provider bars (`UsageLimits`).++## Account menu and Settings (Mac, Linux)++The chat window's account menu copies Grok Bot's: Usage, Get Codync for mobile, Support, Settings, then the signed-in account and Sign out. Everything else is a page of **Settings**, laid out like ChatGPT's desktop settings (references in `reference/chatgpt-settings-*.png`): a sidebar of pages under small group labels (Personal: General, Voice chat, Usage; This Mac: Computers, Updates) and a large page title over the page's sections. Manage computers and approval badges lead to the Computers page. Linux uses `adw::PreferencesDialog` with Computers, Usage and Updates pages (it has no account or voice chat); the iPhone keeps its Computers & settings sheet. Source: `apps/macos/Views/SettingsView.swift`, `apps/linux/src/dialogs.rs` (`settings_page`).Source: `apps/macos/App/CodyncMacApp.swift`.@@ -42,7 +46,7 @@ Other custom screens use `Chrome.swift` and `Controls.swift`:| Tab selection | `TabBar` || Menu / confirmation | `.codyncMenu` (macOS), `DropdownMenu` / `.contextActions` (system menus on iOS), `.codyncDialog` || Toggle | `ToggleStyle.codync` |-| Form-like content | `CardForm`, `CardSection` |+| Form-like content | `CardForm`, `CardSection` (a small bold heading over a filled, rounded group; rows split by inset hairlines; a row is `ValueRow` with an optional one-line `detail`, and its picker is an outlined `ChoicePicker`) |Avoid adding stock `Menu`, `Picker`, `Form`/`List` styling, switch toggles, alerts, `ProgressView`, `TabView` or system sheets to these flows. System presentation APIs inside the shared chrome implementation are implementation details, not permission to bypass the components in feature screens. Native WidgetKit/ActivityKit containers and OS authentication/permission flows remain system integrations.diff --git a/kit/Sources/CodyncUI/Controls.swift b/kit/Sources/CodyncUI/Controls.swiftindex 933a20b6..9926dd2a 100644--- a/kit/Sources/CodyncUI/Controls.swift+++ b/kit/Sources/CodyncUI/Controls.swift@@ -492,7 +492,7 @@ public struct ChoicePicker<ID: Hashable>: View {var fill: Colorvar fitsAvailableWidth: Bool- public init(selection: Binding<ID>, options: [(id: ID, label: String)], fill: Color = Palette.bubbleUser, fitsAvailableWidth: Bool = false) {+ public init(selection: Binding<ID>, options: [(id: ID, label: String)], fill: Color = .clear, fitsAvailableWidth: Bool = false) {_selection = selectionself.options = optionsself.fill = fill@@ -510,6 +510,12 @@ public struct ChoicePicker<ID: Hashable>: View {.appFont(AppFont.compactBody).foregroundStyle(Palette.text).pill(fill: fill)+ .overlay {+ // Unfilled, it's outlined like ChatGPT's settings dropdowns (outline or fill, never both).+ if fill == .clear {+ RoundedRectangle(cornerRadius: 10, style: .continuous).strokeBorder(Palette.border)+ }+ }}.fixedSize(horizontal: !fitsAvailableWidth, vertical: true).help(options.first { $0.id == selection }?.label ?? "Choose")@@ -603,7 +609,7 @@ public struct CardForm<Content: View>: View {public var body: some View {ScrollView {- VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 14, mobile: 22)) {+ VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 28, mobile: 32)) {content}.appFont(AppFont.compactBody)@@ -615,7 +621,9 @@ public struct CardForm<Content: View>: View {}}-/// A titled card of rows: the replacement for `Section`.+/// A titled group of rows: the replacement for `Section`. Modeled on ChatGPT's desktop settings:+/// a small bold heading over a filled, rounded group whose rows are split by inset hairlines+/// (references in `docs/design/reference/`).public struct CardSection<Content: View>: View {let title: String?let footer: String?@@ -628,42 +636,87 @@ public struct CardSection<Content: View>: View {}public var body: some View {- VStack(alignment: .leading, spacing: 6) {+ VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 10, mobile: 10)) {if let title {- Text(title).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary).padding(.leading, 4)+ Text(title)+ .appFont(.system(size: InterfaceMetrics.value(mac: 13, mobile: 15), weight: .semibold))+ .foregroundStyle(Palette.text)+ .padding(.leading, 2)+ .accessibilityAddTraits(.isHeader)}- VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 12, mobile: 16)) {- content+ VStack(alignment: .leading, spacing: 0) {+ _VariadicView.Tree(HairlineRows()) { content }}- .padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 16))- .padding(.vertical, InterfaceMetrics.value(mac: 12, mobile: 16)).frame(maxWidth: .infinity, alignment: .leading)- .background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 18, style: .continuous))+ .background(Palette.surface, in: RoundedRectangle(cornerRadius: 16, style: .continuous))if let footer {- Text(footer).appFont(.caption).foregroundStyle(Palette.tertiary).padding(.horizontal, 4)+ Text(footer)+ .appFont(.caption)+ .foregroundStyle(Palette.secondary)+ .lineSpacing(2)+ .fixedSize(horizontal: false, vertical: true)+ .padding(.horizontal, 2)}}+ .frame(maxWidth: .infinity, alignment: .leading)+ }+}++/// A 1-pixel separator line in the border color.+public struct Hairline: View {+ @Environment(\.displayScale) private var scale++ public init() {}++ public var body: some View {+ Rectangle().fill(Palette.border).frame(height: 1 / scale)+ }+}++/// Lays a section's rows out one under another with an inset hairline between each pair.+private struct HairlineRows: _VariadicView_MultiViewRoot {+ func body(children: _VariadicView.Children) -> some View {+ let inset = InterfaceMetrics.value(mac: 16, mobile: 16)+ ForEach(children) { child in+ child+ .frame(maxWidth: .infinity, minHeight: InterfaceMetrics.value(mac: 28, mobile: 32), alignment: .leading)+ .padding(.horizontal, inset)+ .padding(.vertical, InterfaceMetrics.value(mac: 12, mobile: 14))+ if child.id != children.last?.id { Hairline().padding(.horizontal, inset) }+ }}}/// Label on the left, value on the right: the replacement for `LabeledContent`.public struct ValueRow<Value: View>: View {let label: String+ let detail: String?let value: Value- public init(_ label: String, @ViewBuilder value: () -> Value) {+ public init(_ label: String, detail: String? = nil, @ViewBuilder value: () -> Value) {self.label = label+ self.detail = detailself.value = value()}- public init(_ label: String, value: String) where Value == Text {+ public init(_ label: String, detail: String? = nil, value: String) where Value == Text {self.label = label+ self.detail = detailself.value = Text(value)}public var body: some View {- HStack {- Text(label).foregroundStyle(Palette.text)+ HStack(spacing: 12) {+ VStack(alignment: .leading, spacing: 3) {+ Text(label).foregroundStyle(Palette.text)+ if let detail {+ Text(detail)+ .appFont(.caption)+ .foregroundStyle(Palette.secondary)+ .lineSpacing(2)+ .fixedSize(horizontal: false, vertical: true)+ }+ }Spacer(minLength: 12)value.foregroundStyle(Palette.secondary)}