diff --git a/app/notes/chat-pane-cycle.md b/app/notes/chat-pane-cycle.md new file mode 100644 index 00000000..88e660ff --- /dev/null +++ b/app/notes/chat-pane-cycle.md @@ -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. diff --git a/app/notes/chat-pane-cycle/after-alt-bracket.png b/app/notes/chat-pane-cycle/after-alt-bracket.png new file mode 100644 index 00000000..43dfef04 Binary files /dev/null and b/app/notes/chat-pane-cycle/after-alt-bracket.png differ diff --git a/app/notes/chat-pane-cycle/before.png b/app/notes/chat-pane-cycle/before.png new file mode 100644 index 00000000..e609026f Binary files /dev/null and b/app/notes/chat-pane-cycle/before.png differ diff --git a/app/tool/capture/examples/chat-pane-cycle.json b/app/tool/capture/examples/chat-pane-cycle.json new file mode 100644 index 00000000..899027c3 --- /dev/null +++ b/app/tool/capture/examples/chat-pane-cycle.json @@ -0,0 +1,24 @@ +{ + "size": "1600x900", + "params": "chats=3&colors=1", + "steps": [ + { "open": "/chat/perf-chat-0" }, + { "wait": 1500 }, + { "click": "Chat actions for api refactor" }, + { "click": "Open to the right", "wait": 1500 }, + { "eval": "(window.__k = [], window.addEventListener('keydown', (e) => { if (e.altKey) setTimeout(() => window.__k.push({ code: e.code, prevented: e.defaultPrevented })); }, true), true)", "name": "record" }, + { "click": "xy:800,850", "wait": 800 }, + { "shot": "before" }, + { "keys": [ + { "type": "keyDown", "key": "Alt", "code": "AltLeft", "windowsVirtualKeyCode": 18, "modifiers": 1 }, + { "type": "keyDown", "key": "]", "code": "BracketRight", "windowsVirtualKeyCode": 221, "modifiers": 1 }, + { "type": "keyUp", "key": "]", "code": "BracketRight", "windowsVirtualKeyCode": 221, "modifiers": 1 }, + { "type": "keyUp", "key": "Alt", "code": "AltLeft", "windowsVirtualKeyCode": 18, "modifiers": 0 } + ], "wait": 120 }, + { "shot": "after-alt-bracket" }, + { "eval": "JSON.stringify(window.__k)", "name": "keydown-defaults" }, + { "expect": "window.__k.some((k) => k.code === 'BracketRight' && k.prevented)", "name": "alt-bracket-default-prevented" }, + { "wait": 1200 }, + { "labels": "settled" } + ] +}