Skip to content

feat(native): home lands on a draft, sidebar chrome, keybinding editing - #51

Merged
rynfar merged 3 commits into
nativefrom
nw/w14-home
Nov 2, 2026
Merged

rynfar merged 3 commits into
nativefrom
nw/w14-home

Conversation

@rynfar

@rynfar rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Problem

With no thread open, the native app showed "Select a thread" where the web lands on a draft. The sidebar was missing the web's header and footer controls. The Keybindings settings page was read-only.

Approach

Home (_chat.index.tsx, NoProjectsHero): with nothing open, home opens a draft in the most recently updated project. An empty workspace shows the no-projects hero with Add project and Start without a project (projects.ensureScratch). The draft hero gained the project picker with Add project. Scratch drafts ask "What should we work on?", and drafts add an "or start without a project" line. chat.newWithoutProject is now bound. HostedEmptyState is n/a: the native connect screen covers that case.

Sidebar chrome (SidebarChrome.tsx, SidebarThreadHeader.tsx): the brand links home. New thread sits with Filter by project and Add project, each with a tooltip. The filter shows the list-filter icon, or the selected projects' favicons when filtered. The footer is a row of 32px buttons (Settings, Pull requests, Usage, now wired to the usage page from #47), with Back while the PR page is open and the undo notice inline.

Keybindings editing (KeybindingsSettings.tsx, KeybindingsSettings.logic.ts):

  • Click a shortcut pill to record. The field captures every chord, including bound ones like Cmd+K, through a keystroke interceptor. Escape restores the saved key, and Tab passes through once a chord is recorded.
  • The when clause opens a builder popover with the expression field, parse errors, unknown-condition warnings, and the visual tree (Not, variable, and/or, + Condition, + Group, remove).
  • Each row shows its conflicts, a source badge, and Save while edited. The hover menu offers Reset to default and Remove.
  • Add keybinding opens a new row with a command picker. Open keybindings.json opens the file in the preferred editor.
  • Writes go out as server.upsertKeybinding / server.removeKeybinding. The reply's keymap is applied and installed at once (apply_keybindings_reply → sync_server_config). Drafts of rows the new keymap replaced are dropped.
  • The pure logic lives in crates/core/src/settings/keybindings.rs with tests: rows, sources, defaults, conflicts, the when tree edits, payloads, and keystroke→keybinding.

Ledger

  • KB-USER: editing added; stays partial. Not ported yet: the KeybindingsConfigWarning toast and settings:write gating.
  • SB-HEADER: done.
  • New TV-HOME row: done.
  • TV-DRAFT: now lists TriageDraftHero.tsx.

Evidence

Offscreen snapshots against the read-only real-data server:

  • Before, home: /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w14-before-home.png
  • After, home: /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w14-after-home.png
  • Before, keybindings: /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w14-before-keybindings.png
  • After, keybindings: /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w14-after-keybindings.png
  • Edited row, new row, and conflicts (states seeded by a temporary patch that is not committed): /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w14-after-keybindings-edit.png
  • When builder, dark: /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w14-after-keybindings-when.png
  • When builder, light: /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w14-after-keybindings-when-light.png

Wire round trip on the smoke server, using the exact payloads Settings sends. It added, replaced and removed a chat.new binding, then restored the server (no custom bindings left):

> server.upsertKeybinding {"command":"chat.new","key":"mod+shift+alt+9","when":"terminalFocus"}
< chat.new rows: mod+alt+shift+9 when="terminalFocus" source=Custom | mod+n Default | mod+shift+o Default
> server.upsertKeybinding {"command":"chat.new","key":"mod+alt+shift+8","replace":{"command":"chat.new","key":"mod+alt+shift+9","when":"terminalFocus"}}
< chat.new rows: mod+alt+shift+8 when="" source=Custom | mod+n Default | mod+shift+o Default
> server.removeKeybinding {"command":"chat.new","key":"mod+alt+shift+8"}
< chat.new rows: mod+n when="!terminalFocus" Default | mod+shift+o when="!terminalFocus" Default
custom bindings left: 0
stream: KeybindingsUpdated (x3)

Gates: cargo test --workspace (677 passed), clippy -D warnings, gen-theme --check, parity/sync.test.ts, conformance --check.

Not verified in a live window: clicking, recording chords and editing the builder. Screen capture is unavailable, so the states above come from offscreen renders.

Built with Claude Opus 5.5 in Claude Code.

- Home opens a draft in the most recent project like the web index route, and shows the no-projects hero (Add project, Start without a project) when the workspace is empty
- Draft hero: project picker with Add project, scratch drafts ask what to work on, and an 'or start without a project' line; chat.newWithoutProject is bound
- Sidebar: brand links home, New thread joins Filter and Add project with tooltips, list-filter icon or scoped favicons, and the footer row of Settings, Pull requests and Usage with the undo notice inline
- Rows record a shortcut in place, edit their when clause in a builder popover (expression field and visual tree), show conflicts, and save through server.upsertKeybinding
- Add keybinding row with a command picker, row menu with Reset to default and Remove (server.removeKeybinding), and Open keybindings.json
- The reply's keymap installs at once; drafts of replaced rows drop when the keymap changes
- Ledger: KB-USER editing, SB-HEADER done, new TV-HOME row
- Keybinding replies apply only while no newer keymap streamed since the edit was sent
- Recording keeps a layout's own glyph using GPUI's key equivalents, as the web's recorder does
- Home and new-thread drafts are navigation entries, so Back returns to the thread before them; a launched draft gives way to its thread
- Shortcut pills, shortcut fields and when triggers are tab stops; focusing a field arms it, and the builder takes focus and returns it on close
@rynfar

rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Review fixes are in f4947a75ae. The branch is rebased onto native, including #50 (Settings → Providers).

Fixed, all four:

  1. Stale replies. Keybinding replies now carry a revision guard, the same way settings replies do: a reply applies only if no newer keymap streamed in after the edit was sent. Test added in server_config/tests.rs.
  2. Layout-dependent recording. GPUI on macOS drops Shift for shifted symbols, so the recorder now reads GPUI's key-equivalents table for the current layout. It turns a shifted glyph into Shift + the base key only when the glyph sits at its US position. Other glyphs are recorded as typed, with Shift restored when the layout puts that glyph where US has a shifted one. This matches the web's recordedLayoutShortcutKey. Tests cover British £, a layout with an unshifted #, and German Ö. Limit: a layout missing from GPUI's table falls back to US positions.
  3. Back after Home. Drafts, including the home draft and new threads, are now history entries, so Back returns to the thread you left. A draft that launches its thread is replaced by that thread in history.
  4. Keyboard access. Shortcut pills, shortcut fields and When triggers are now tab stops, with a focus ring when reached by keyboard. Focusing a field starts recording, like the web's onFocus. Enter or Space on a pill starts recording. The When builder takes focus when it opens and gives it back to its trigger when it closes.

Dismissed: none.

Gates after the rebase: cargo test --workspace (698 passed), clippy -D warnings, theme check, parity sync test, conformance check.

@rynfar
rynfar merged commit b9227e6 into native Nov 2, 2026
This was referenced Nov 2, 2026
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