Merge main

This commit is contained in:
2026-12-03 23:19:18 +00:00
39 changed files with 2472 additions and 126 deletions
+53
View File
@@ -0,0 +1,53 @@
# Cycling the chat panes on screen
Alt+] and Alt+[ move the keyboard to the next or previous chat pane on screen
(wide layouts only). On macOS and iOS, Cmd+] and Cmd+[ do the same.
## Keys
- Alt+Tab and Cmd+Tab belong to the OS window switcher. Ctrl+Tab already
cycles the open chats, and Alt+` cycles the floating windows.
Alt+Y, Alt+K, Alt+L, Alt+T and Ctrl+B are also taken.
- Browsers use Alt+Left and Alt+Right for back and forward. GNOME, Hyprland,
Windows and browsers do not bind Alt+[ or Alt+]. The web build handles the
key, so Flutter calls `preventDefault`. The capture's keydown recorder shows
this (`prevented: true`).
- On a Mac, Option+] and Option+[ type quotes. With Alt, the shortcut matches
the key's position, as Option+Y does. Cmd+] and Cmd+[ are the macOS
next/previous pair, so Option stays free for typing. On the web, Cmd+[ is
Back, and the app prevents that default.
- The shortcut never matches with Shift (Alt+Shift+[ types a brace), Ctrl or
AltGr. AltGr is how several layouts type brackets.
- A focused terminal (any `TypingSurface`) keeps the keys. Alt+[ is its
escape prefix.
## Behaviour
- Order: the tiled panes in split-tree order, which is visual order (left
before right, top before bottom; the center stage's row in order). Then
come the shown floating chat windows in the order they were opened. The
cycle wraps around. The shortcut never opens, closes, hides or moves a
chat.
- The target's composer takes focus. If nothing in the pane takes focus, a
pane-level focus node takes it. The pane's border flashes in the chat
colour for 700 ms (`ChatPaneFocusFlash`). The flash uses the design's
corner radius. Under reduced motion it shows for the same time without
fading.
- It does nothing in these cases: one pane on screen, a phone layout (the
stack and the quick switcher handle chats there), a popup or another
destination open, or a focused terminal.
- The shortcut is listed in the keyboard shortcuts list (Settings and the
Ctrl+? cheatsheet) as "Next or previous chat pane on screen".
## Evidence
- Tests: `test/features/chat/chat_pane_cycle_test.dart` (three tiles plus a
window, forward, backward and wrapping; two tiles plus a window; no-op
with one pane and on a phone; terminal keeps the keys) and
`test/features/chat/workspace/chat_pane_cycle_test.dart` (key matching,
labels, wrap).
- Capture: `tool/capture/examples/chat-pane-cycle.json` with
`CHROME_PATH=/usr/bin/chromium`, at 1600x900. `chat-pane-cycle/before.png`
shows the left pane focused. `chat-pane-cycle/after-alt-bracket.png` was
taken 120 ms after Alt+]: the right pane (api refactor) is active, its
composer has the caret, and its purple ring is fading.
Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

+46 -6
View File
@@ -16,17 +16,52 @@ they are saved on the device.
- `flutter_tts_speech_engine.dart`: the `flutter_tts` implementation. The rate
is a multiplier (1.0 = normal); Apple platforms get half of it on their 0..1
scale. Linux reports unsupported, so the button and section are hidden.
- `speech_controller.dart`: the app's single reader (`speechController`, a fake
in tests via `debugSpeechController`). State changes notify the controller;
the spoken word is the separate `word` notifier. Stops on `hidden`, `paused`
or `detached` (not `inactive`, which is only a lost focus).
- `speech_controller.dart`: the reader. State changes notify the controller;
the spoken word is the separate `word` notifier and the reading's
conversation (`SpeechReading`: chat id and name) the `reading` notifier.
Stops on `hidden`, `paused` or `detached` (not `inactive`, which is only a
lost focus): the phone app backgrounded keeps that behaviour.
- `app_speech.dart`: the app's single reader (`speechController`, a fake in
tests via `debugSpeechController`), `speechControllerIfCreated` for code that
only stops or relabels, and `speechReading`, the app-level listenable the
avatars and the global control follow.
- `speech_document.dart`: Markdown to sentences, with each spoken character's
part and source offset. Code blocks (``` and ~~~) are "Code block.", tables
"Table." then cells; rules are skipped.
- `chat_markdown_speech.dart`: highlight spans and the reveal scroll for
`ChatMarkdownView`.
- Reader ids are `<sessionId>/<row id>` so a chat that closes or is swapped
for another stops only its own reply (`stopScope`).
- Reader ids are `<sessionId>/<row id>`; `SpeechOrigin` (put by the thread
view) gives Read aloud the chat id and name when a reading starts.
## Keeps reading across chats
The reader belongs to the app, not the thread view: switching chats or panes,
opening the chat list or another destination keeps the reply reading, and
reopening the chat shows its Pause/Stop again. A reading ends when it is
stopped (the reply's Stop or the global one), finishes, another reply starts,
its chat is closed (`/close`, the row's Close, or a refreshed row closed
elsewhere) or deleted (gone from a successful list read, which includes its
machine being removed), and when the app closes or is backgrounded.
- Indicator: `chatSessionActivityBadge(speaking:)` draws
`ChatSpeakingGlyph` (three animated bars; a still speaker under reduced
motion) in the avatar's bottom-right badge, ahead of the operator wait, the
running spinner and the background-task count. `ChatSessionAvatar` (list,
quick switch, phone chat stack, pane header) and `ChatCompactAvatar`
(compact sidebar) follow `speechReading`.
- Global stop: `ChatSpeakingControl`, "Speaking · <chat>" (or "Paused") with
Stop speaking, sits above the composer of the active pane (`pasteTarget`)
of any chat, so one copy shows whatever the layout. It uses the design's
panel fill, frame and corner tokens.
- Servers: federated chat ids carry their machine, so moving between machines
in the combined list keeps reading. Switching the server profile (native)
remounts `PipelinesApp`, whose dispose stops the reader; on the web a server
switch loads another page, which ends speech.
- Detached windows are separate processes (desktop) or browser windows (web),
each with its own reader: speech belongs to the window that started it,
shows only there, and stops when that window closes.
- Web: the utterance is held by `WebSpeechEngine`, owned by the app reader,
never by a widget.
## Platform notes
@@ -49,7 +84,12 @@ Tests (fake engine): `test/features/chat/speech/`,
`test/features/chat/ui/transcript/chat_read_aloud_button_test.dart`,
`chat_markdown_read_aloud_test.dart`,
`test/features/chat/conversation/chat_thread_read_aloud_test.dart`,
`test/features/chat/ui/sessions/chat_speaking_badge_test.dart`,
`chat_sessions_speech_test.dart`,
`test/features/settings/settings_read_aloud_section_test.dart`.
Captures (`speech=fake`, Terminal and Classic, wide and phone) show the badge
on the reading chat after switching to another one, and the global control.
Not verified on a device: real speech output, word boundaries and voices on
Android, macOS and browsers.