Skip to content

feat(native): settings modal with search, general, appearance, chat, threads, keybindings, archive and environments - #30

Merged
rynfar merged 8 commits into
nativefrom
nw/w7-settings
Nov 2, 2026
Merged

rynfar merged 8 commits into
nativefrom
nw/w7-settings

Conversation

@rynfar

@rynfar rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Problem

The native client had no settings. Theme followed the OS only, per-device preferences could not be changed, server-backed defaults (permissions, workspace, auto-settle, snooze options) were read-only, and there was no way to see archived threads, the keymap, or the connected environment.

Approach

Shell (crates/app/src/settings/mod.rs, crates/core/src/settings/search.rs). A modal over the current thread: max 1280×960, radius 16, 240px nav, content max 896, as AppRouteModal.tsx and design system §5 describe. It opens from Cmd+, the app menu ("Settings..."), the command palette ("Open settings"), and from palette settings results. Esc clears search first and then closes; the backdrop closes too. Nav order and labels follow SETTINGS_NAV_GROUPS. Sections that aren't ported are hidden, and empty groups are dropped. Settings search ports searchSettings (same ranking, keybinding results last) over the rows that exist. Up/Down/Enter work, / and Cmd+F focus search, and a result scrolls to and tints its row. The view only exists while the modal is open.

Where edits go (crates/app/src/settings/store.rs).

  • Client settings use the web's ClientSettingsSchema keys in settings.json under T3_NATIVE_HOME. crates/core/src/client_settings.rs decodes each key on its own with the contract default, keeps unknown keys, and survives a corrupt file. Writes go through the store's existing ordered, coalescing, atomic writer, off the UI thread.
  • The composer's ClientSettings (send shortcut, follow-up, plan mode, notification mode) is re-derived from the same file on every edit, so changes take effect live.
  • Server settings save as ServerSettingsPatch entries through server.updateSettings. The reply is applied as a settingsUpdated event, so every view reads the saved value. A failure shows the web's "Setting not saved / Could not save on {label}: …" above the page.

Panels (copy and defaults ported from the named web sources):

  • General (SettingsPanels.tsx, NotificationSettings.tsx): thread notifications (default Off), in-app notifications, project grouping (remembers the last repository mode), project order, Working section, unpin/archive/delete confirmations, quit shortcut, time format. Reset buttons appear when a value differs from its default.
  • Appearance (ThemeSettings.tsx, AppearanceSettingsPanel.tsx, TypographySettings.tsx): System/Light/Dark tiles and the theme library (T3 Code plus tokens::BUILT_IN_THEMES). These switch live and atomically through crate::theme, stored with the web's t3code:theme / t3code:theme-appearance-mode vocabulary. Interface font size (12–20) drives the rem scale. Chat width (comfortable 736 / wide 1152 / full) drives the transcript and composer lane.
  • Chat: send shortcut and follow-up behavior. Labs: Plan mode (legacy).
  • Threads (ThreadsSettingsPanel, ProjectDefaultsSettings.tsx, SnoozePresetsSettings.tsx): add-project base directory, default model, fallback model, permissions, workspace. The snooze options editor covers when, amount stepper, unit, time, remove, add (max 8), the "Menu now" preview, passed/duplicate notes, and reset. Also: usage limits, auto-settle (merged, inactive, days, keep PRs behind the threadAutoSettlementScope capability), and response streaming.
  • Keybindings: a searchable table of the environment's resolved keymap, grouped like groupKeybindingRows, labelled with commandLabel. It reuses crate::keybindings for decoding and shortcut labels.
  • Archive (ArchivedThreadsPanel.tsx, orchestration.getArchivedShellSnapshot): grouped by project, newest first. Unarchive works from a button or the right-click menu. Delete is in the right-click menu and confirms with a native prompt (the confirmAndDeleteThread copy) while delete confirmation is on.
  • Environments / About: the connected environment (label, address, server version, orchestration protocol, live status), Disconnect (forget_connection), and the app version.

Settings primitives (button variants, switch, select with keyboard support, section/group/row) live in settings/controls.rs and are sized in rems, so the modal follows the interface size.

Ledger rows

ST-SHELL, ST-GENERAL, ST-APPEARANCE, ST-CHAT, ST-THREADS, ST-ENVS, ST-LABS, ST-ABOUT, ST-ARCHIVE → partial; KB-USER native path extended.

Verification

  • cargo test -p t3-core -p t3-client passes (new tests cover client settings decoding and round trips, legacy confirmQuit, theme mode pinning, thread settings defaults and lenient decoding, a guard that no flattened key is shadowed by ServerSettings, patch payloads, the update reply through the reducer, snooze labels and editor rules, nav and search ranking, keymap rows and groups, and archive grouping and labels).
  • cargo clippy --workspace --all-targets -- -D warnings, node scripts/gen-theme.ts --check, node --test parity/sync.test.ts, node conformance/generate.ts --check all pass.
  • Headless round trip against the isolated dev server (crates/client/examples/settings_probe.rs):
server  http://127.0.0.1:14658
stream  snapshot         sidebarAutoSettleOnMerge = true
send    server.updateSettings {"patch":{"sidebarAutoSettleOnMerge":false}}
reply   sidebarAutoSettleOnMerge = Some(false)
stream  settingsUpdated  sidebarAutoSettleOnMerge = false
send    server.updateSettings {"patch":{"sidebarAutoSettleOnMerge":true}}
reply   sidebarAutoSettleOnMerge = Some(true)
stream  settingsUpdated  sidebarAutoSettleOnMerge = true
restored sidebarAutoSettleOnMerge = true
  • Archive cycle on the dev server (archive → read as the panel does → unarchive):
send    thread.archive Ok("ok")
archive server / "Native client showcase" — Archived just now · Created 1h ago
send    thread.unarchive Ok("ok")
  • Read-only decode against the real-data server: keymap 81 commands; first: ("Appearance: Cycle", ["⌥⇧⌘A"]), thread settings decoded with defaults.
  • App smoke run on the dev server: every section opened and rendered with no panic (General 4 blocks, Appearance 3, Chat 2, Keybindings 8, Threads 6, Environments/Labs/About 1, Archive loading→loaded). A palette-style jump to "Days of inactivity before auto-settle" landed on Threads with the row targeted. Theme, appearance mode, font size and chat width changes applied and persisted across a relaunch.
  • No screenshots: screen capture isn't available in this session (screencapture: could not create image from display). Before/after images still need to be taken.

Gaps

  • Settings scope picker (project/checkout scope, mixed values, inheritance markers) and "Restore device defaults".
  • Appearance: custom/imported/environment themes and the theme editor, theme halves, contrast, glass opacity, font families, prompt/code/terminal sizes, font smoothing, word wrap, effort display, math, panel animations, environment identification, thread details items.
  • Threads: text generation model, effort traits for default/fallback models, thread title instructions. The snooze editor keeps stored order rather than re-sorting on blur.
  • Keybindings are read-only: recording, adding and removing (server.upsertKeybinding / server.removeKeybinding) wait on KB-USER editing.
  • Archive hides nothing for hiddenThreadTags, and shows a folder icon instead of project favicons.
  • Environments covers the single paired connection only; saved, linked and remote environments, sharing and the rest of the nav aren't ported.
  • Some settings are saved here but no native feature reads them yet: sidebar grouping, sort and Working section (SidebarSettings defaults), time format, confirmations, response streaming display. Each feature's owner can read settings::store::client(cx).
  • No sidebar footer Settings button yet (SB scope).

Built by Claude Opus 5.5 in Claude Code.

Client settings decode per key with the contract's defaults and keep unknown
keys; the file is written atomically. Server settings the Threads panel edits
decode leniently and save as ServerSettingsPatch entries. Ports settings
search and nav order, snooze preset rules, the keymap table, and archive
grouping, with tests and a headless probe.
… keybindings, archive and about

Cmd+, and the app menu open settings over the current thread: section nav and
search, General, Appearance (themes and modes switch live, interface size,
chat width), Chat, Labs, Threads (defaults, snooze options, usage limits,
auto-settle, streaming), a read-only Keybindings table, Archive with unarchive
and delete, and Environments with Disconnect. Server-backed rows save through
server.updateSettings and follow config updates.
Adds the web's Open settings action and lists settings search results in the
palette; picking one opens the modal at that row.
…fallback fields

Both keys now decode once on ServerSettings; a test guards every flattened
key against being shadowed.
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