Skip to content
Source
Sign inSign up
pingdotgg/t3code

Keyboard-select composer controls with hold-modifier hints #4271

Closedcolonelpanic8(GitHub profile, opens in a new tab)wants to merge 17 commits intomain fromrefs/pull/4271/headopened View on GitHub

What

Makes every selector in the thread first-prompt composer keyboard-operable through the app's existing customizable keybindings system, extending the pattern already used by modelPicker.toggle.

CommandDefaultControl
modelOptionsPicker.togglemod+shift+eReasoning effort / model traits menu
runtimeModePicker.togglemod+shift+aAccess level (Supervised / Auto-accept / Full access)
planMode.togglemod+shift+pPlan ↔ Build toggle
environmentPicker.togglemod+shift+vBranch toolbar environment
envModePicker.togglemod+shift+lLocal vs worktree
branchPicker.togglemod+shift+bBranch selector

(mod = Ctrl on Linux/Windows, Cmd on macOS.)

All six are rebindable in Settings → Keybindings — they flow through the existing command registry, so their labels are derived by commandLabel and they're upserted into existing user configs by the server's startup sync. No new settings surface was added.

Hold-modifier hints

Holding the platform mod key reveals a small Kbd keycap on each control, in the disclosure chevron's slot. A keycap and a chevron are within a few pixels of each other, so the row barely moves, the current values (model, effort, access level, Plan/Build) stay readable, and the composer footer and branch toolbar share one treatment.

At rest, then with the modifier held:

Composer controls at rest and with the modifier held

Dark:

Composer controls with the modifier held, dark theme

Visibility is computed via shouldShowCommandHintForModifiers, which deliberately uses subset modifier matching (not the exact-match used by thread jumps) so that holding a bare Ctrl/Cmd reveals the full mod+shift+* chords.

Caps show the whole chord. Apple's glyphs (#4701) are what make that fit: ⌃⇧E sits in a chevron slot where Ctrl+Shift+E needed a row of its own.

Depends on #4701

The Apple-glyph shortcut labels live in #4701 and are carried here so this branch stands alone. Once #4701 merges, rebasing drops the duplicate.

Run-context behaviour

  • envModePicker.toggle flips local ↔ worktree directly instead of opening a two-item menu, matching how planMode.toggle already behaves. Clicking still opens the menu, which is what surfaces the worktree path. On mobile the control lives in the combined run-context sheet, which still opens.
  • The environment and workspace indicators now explain themselves while inert, distinguishing a thread that has already started from a project with only one environment. They previously rendered as muted, chevron-less controls that silently did nothing.

Fallbacks

  • Compact footer: the effort/runtime toggles open CompactComposerControlsMenu; the Plan/Build toggle still flips directly.
  • Mobile: environment / env-mode open the combined MobileRunContextSelector menu.
  • Each toggle reports whether its control was actually available; when it wasn't (locked provider, approval pending, collapsed, etc.) the command no-ops without calling preventDefault, so the browser default still fires.

Tests

Extended keybinding coverage in packages/contracts, apps/web (mac vs non-mac, subset semantics, customized bindings, no-binding, label resolution, mod-key subtraction, label stability as modifiers go down, glyph output), and apps/server defaults enumeration. Typecheck, lint, and the apps/web suite pass (182 files / 1648 tests).

🤖 Generated with Claude Code


Note

Medium Risk Touches global shortcut resolution, label formatting (visible UX change on Linux/Windows), and thread run-context (env/workspace/branch) behavior; mitigated by extensive tests and graceful no-ops when controls are locked.

Overview Adds six rebindable shortcuts (mod+shift+e/a/p/v/l/b) for model options, runtime mode, plan/build, environment, workspace mode, and branch pickers, wired through the existing keybindings registry and ChatView’s global keydown handler.

Composer footer gains mutually exclusive, layout-scoped picker open state (model, traits, runtime mode, compact “more” menu), new ChatComposerHandle toggles that no-op without preventDefault when unavailable, and hold-modifier hints that swap disclosure chevrons for compact keycaps via shouldShowCommandHintForModifiers (subset modifier matching).

Branch toolbar exposes BranchToolbarHandle for the same shortcuts: desktop pickers are centrally opened/toggled (one overlay at a time), mobile env/workspace shortcuts open the combined run-context menu, and desktop envModePicker.toggle flips local ↔ worktree directly instead of opening the two-item menu. Inert environment/workspace indicators get tooltips explaining why they can’t change.

Shortcut labeling is unified to Apple-style glyphs on all platforms (⌃⇧E vs Ctrl+Shift+E), with settings chips using shared formatShortcutTokenLabel.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5751b4bae4fa92f8fdb0c32b0af33c2371192fbf. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add keyboard shortcuts to toggle composer and branch toolbar controls with hold-modifier hint badges

  • Adds six new keybinding commands (modelOptionsPicker.toggle, runtimeModePicker.toggle, planMode.toggle, environmentPicker.toggle, envModePicker.toggle, branchPicker.toggle) with default mod+shift+* bindings gated by !terminalFocus.
  • When the user holds the modifier keys, inline shortcut hint keycaps (ComposerShortcutKeycap) replace or supplement chevron icons on picker triggers in the composer and branch toolbar.
  • Picker open states are centrally orchestrated as mutually exclusive across the composer (model, traits, runtime mode) and branch toolbar (environment, env-mode, branch), with imperative ref-based toggle handles exposed for programmatic control from ChatView.
  • Shortcut labels now render as Apple-style glyphs (e.g., ⌃⇧P) on all platforms instead of word-based Ctrl+Shift+P format.
  • Adds useLayoutScopedOpenState to reset picker open state immediately when the rendered layout changes, and useTerminalFocus to gate shortcuts away from the terminal.
  • Behavioral Change: formatShortcutLabel output changes globally — non-macOS platforms now get glyph labels (e.g., ⌃⇧D) instead of Ctrl+Shift+D, affecting the keybindings settings UI and any other consumers.
Macroscope summarized 5751b4b.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 2113c4bb-3c78-4a5c-9955-a73b2ad7578c

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR introduces a new keyboard shortcut feature for composer and toolbar controls, with visual hint badges appearing when modifier keys are held. New user-facing features with new components, new hooks, and new state management patterns warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Superseded by #4701, which carries the Apple-glyph shortcut labels on their own against main.

      The composer hold-modifier hint work from this branch (keycaps in the disclosure-chevron slot, direct local ↔ worktree toggle, self-explaining locked run-context indicators) stays on colonelpanic8:t3code/composer-keyboard-shortcuts if it's wanted later.

Sign in to join this conversation.