Files
pipelines/app/notes/chat-quick-switch.md
T
alan 141661e355 Chat: Ctrl+K / Alt+K on Chat opens a quick switcher for the open chats
On Chat the chord now toggles a centred dialog (bottom sheet on a phone)
with an autofocused filter over the open chats in list order; Ctrl+N/Down
and Ctrl+P/Up move the wrapping selection, Enter opens the chat as Ctrl+Tab
does (pane reused, composer focused), Esc or the chord closes it. From other
destinations the chord still jumps to Chat. Ctrl+N/Ctrl+P are handled so the
web page prevents their defaults (Ctrl+P no longer prints); a browser tab
keeps Ctrl+N reserved, documented in the help and notes/chat-quick-switch.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 12:27:39 +00:00

45 lines
2.6 KiB
Markdown

# Chat quick switcher (Ctrl+K / Alt+K on Chat)
Ctrl+K / Alt+K (Cmd+K / Option+K on a Mac) from another destination still
jumps to Chat and focuses the open chat's composer. On Chat it now toggles a
quick switcher: a centred dialog (full-width bottom sheet below 600 px) with
an autofocused field over the open chats.
- Wiring: `AdaptiveShell.onChatQuickSwitch` (shell, only when Chat is already
selected) -> `PipelinesApp._toggleChatQuickSwitch` ->
`ChatRuntime.quickSwitch` -> the mounted `ChatScreen`
(`lib/features/chat/chat_screen_quick_switch.dart`). A chosen chat opens
through `_openByShortcut`, the same path as Ctrl+Tab: an already-open pane
is reused (`ChatWorkspaceController.open`) and its composer takes focus.
Another popup or dialog over the chat keeps the keyboard (no switcher).
- Rows and ordering: `lib/features/chat/domain/chat_quick_switch.dart`. Empty
query = the list's order (Starred by name, then Chats by directory in server
recency), closed chats excluded, folds ignored. Query words must all match
title / directory / workspace / harness / machine name; rank per word: title
start, title word start, other word start, title substring, other substring.
- Keys (`chat_quick_switch_keys.dart`): Ctrl+N / Down, Ctrl+P / Up (wrap),
Enter, Esc. Control rather than Cmd on a Mac, as in Search.
## Browser reserved keys
Chromium `BrowserCommandController::IsReservedCommandOrKey`
(chrome/browser/ui/browser_command_controller.cc) and `kReservedCommandIds`
(chrome/browser/ui/accelerator_table.cc): IDC_NEW_WINDOW (Ctrl+N), IDC_NEW_TAB,
IDC_CLOSE_TAB, IDC_CLOSE_WINDOW, tab cycling etc. are reserved in a normal tab,
so the page never sees Ctrl+N there. IDC_PRINT is not reserved, so Ctrl+P is
cancellable. "In Apps mode, no keys are reserved" (TYPE_APP / TYPE_APP_POPUP:
the installed PWA window), and in fullscreen everything except exit/fullscreen
reaches the page; the terminal's "Capture browser keys" (Keyboard Lock in full
screen, `TerminalBrowserKeys.instance`) is page-wide, so it already covers the
switcher with no generalisation. Decision: keep Ctrl+N/Ctrl+P as asked
(handled -> Flutter web calls preventDefault), keep Up/Down as the always-working
pair, no extra Alt+N/Alt+P; the help entry says a browser tab keeps Ctrl+N.
## Evidence
`tool/capture/examples/chat-quick-switch.json` (fixture `chats=8&colors=1&activity=1`)
records keydown `defaultPrevented` through CDP: Alt+K, Ctrl+N, Ctrl+N and
Ctrl+P were all prevented in Chromium, light and dark. CDP key events bypass
the browser's own accelerators, so the reserved-key behaviour above comes from
the Chromium source, not from the capture.