4.1 KiB
4.1 KiB
Floating chat pane
On a wide layout one chat at a time can leave the split tiling and float in a window over the app, like the floating terminal. Ctrl+Y (Cmd+Y on macOS) shows or hides it.
Behaviour
- Float: a tiled pane's More menu offers
Float (Ctrl+Y)(Cmd+Yon Apple platforms) when another chat stays in the tiling. A single chat cannot float, because the tiling would be empty. Floating a second chat swaps them: the chat that was floating goes back into the tiling where the new one was. - Window: you drag it by its title bar and resize it from the lower right
corner. The title bar has Dock and Hide buttons. The window keeps its frame
inside the app when the browser window resizes (
fitChatFloat). Grow and fade in, and shrink and fade out, useMotion.standardthroughMotion.of, so reduced motion and the animation speed apply. - Floating chat's menu: Dock (back into the tiling, right of the active pane,
which it becomes),
Hide floating chat (Ctrl+Y), and Close pane (removes it from the workspace; no backend close). If the last tiled pane closes, the floating chat docks in its place. - Shortcut: Ctrl+Y on every platform, and Cmd+Y on macOS and iOS. It is an
early key handler, so it works from a composer or the terminal; Y, Shift+Y and
Alt+Y still type. When no chat floats, Ctrl+Y floats the tiled pane that has
the keyboard. When no pane has the keyboard, or that pane cannot float, the
chord is left alone. So in the terminal Ctrl+Y stays the shell's yank until a
chat floats. After that, on Windows, Linux and web, Ctrl+Y toggles even from
the terminal (yank is unavailable there, as with Ctrl+T). On macOS, Ctrl+Y in
a
TypingSurface(terminal) always goes to the shell, and Cmd+Y toggles. - Focus: showing the chat focuses its composer. Hiding it gives the keyboard
back to whatever had it before (as
TerminalFocusdoes), otherwise the keyboard is unfocused. - Where it shows: only on a wide layout and while Chat is the current destination. On narrow or phone layouts, and on other destinations, the menu item is absent and the chord passes through. A chat that is already floating stays floating there, unpainted, with its state, and reappears when the window is wide again.
- Persistence:
pipelines.next.chatFloat.v1is stored device-locally and scoped like the workspace layout. It records the floating pane's id and session, whether it is shown, and the frame. It is restored after the workspace layout. A saved float whose session is already tiled is dropped.
Design
ChatWorkspaceControllerkeeps the floating pane outside the tree (chat_workspace_float.dart, apartwith theChatWorkspaceFloatextension).panesandpaneCountstay tiled-only. The pane keeps its id through float, swap, hide and dock.ChatWorkspacegives each pane's content aGlobalKey. The floating chat is that same keyed subtree, built byChatFloatHostinside the workspace, so theChatThreadViewState, draft, scroll and running turn move with it and are not rebuilt. Its inherited context and focus tree stay in the workspace.FloatingLayer(lib/ui/floating/) paints a layer in the root overlay throughOverlayPortal. The chat window covers the whole app. The terminal's floating window now uses the same layer, so the two share one z-order: the last one pressed, focused or opened is on top. Without an overlay (bare widget tests) the layer paints in place.- New files:
chat_float_{host,window,binding,store,shortcut}.dart,chat_workspace_float.dart,chat_screen_float.dartandui/floating/floating_layer.dart. Existing files changed: workspace controller hooks (open, split, close, replace, restore), theChatWorkspace.floatFrameparameter and keyed content, the pane controls and/closeand/newhandling inscreen.dart, the persistence wiring inchat_screen_workspace.dart, andterminal_stage.dart.
Not done
- The sidebar's "visible" highlight does not count the floating chat.
- Cmd+Y in a browser on macOS may be taken by the browser (History) before the app sees it. Ctrl+Y works there.