Floats and drawers in the app¶
Part of docs/architecture.md. The model, server methods, CLI, Lua and
leon attach side (M20a) is in Protocol and clients; this is how the
app draws and moves them (M20b).

- One copy of the overlays. The shared client (
leon_app::remote) keeps each window'sfloatinganddockedfromsession.viewinSession::overlays(by window id), and each block's label. It reads only the fields it knows, since a newer server may add some and the core types refuse unknown ones, and a window whose placements failOverlays::check(a float outside the window, a size past 1, one block placed twice, more than 64 floats) gets none, so a remote server can't hand the layout NaN, off-screen rects, or a list that makes each frame quadratic. Ids are stripped of hidden characters like every remote name, and so is a program name shown in the switcher.leon attachreads the same copy; it no longer fetches the view itself. The input target (floats::target: a focused overlay, even over a zoomed tile, else the zoomed tile, else the focused one) is shared by both. - Geometry (
leon_app::floats, GPUI-free). Visible drawers take their side's share of the pane area in list order, each clamped to what is left; the tiles are laid out in the rest; the channel between a drawer and the tiles is its divider. Floats sit at their bounds of the whole pane area, back to front.Placed::hitgives the topmost float under a point, then a drawer; the app uses it so cmd-hover over a float finds the float's grid, not the tile under it (GPUI'soccludealready keeps clicks off the tiles below). - Drawing. A float or drawer is the same tile as a pane (header with title, host and status;
terminal; find bar), always with its header. Its header controls are unfloat and close instead
of split and zoom. Floats get a 1 px border (Amber when focused, else the border colour) and a
shadow, and are drawn after the drawers in z-order. A tab is named by its tiles, never by a
float or drawer that has the focus: the client remembers each window's tile focused last
across refetches (
Session::named_tile), since the server keeps only the focus. A click focuses the pane under it (session.focus_block, which raises a float). - Dragging. A float's header moves it, its edges and corners resize it (never under
160×80 px, never out of the window), and a drawer's divider sets its size (0.05–0.95; a size
set outside that by the CLI stays until the drag moves it). Each step that changes the
placement is one call (a drag ends if the block was moved, hidden or unfloated elsewhere
meanwhile, rather than undo that), like a divider drag:
session.float_blockwith the new bounds, orsession.dock_blockwith the drawer's own side and new size. So the CLI and attach see the drag as it happens.dock_blockon a drawer's own side keeps its place in the dock list (which decides the drawer that spans a corner); another side still moves it to the end. - Slides. When a drawer of the active window is shown or hidden (
leon toggle, ⌘J, the switcher), it slides from or to its edge over 120 ms, eased out. The tiles take their new size at once and the drawer is only translated, so its PTY is never resized mid-slide; one hiding stays drawn (and watched) until its slide ends, but clicks go to the tile under it (focusing it would show it again). A drawer turned back mid-slide carries on from where it was. With Reduce Motion (accessibilityDisplayShouldReduceMotion) nothing slides. A tab seen the first time slides nothing, so opening the app is still. - Actions.
pane.float,pane.new_floating,pane.unfloat,pane.scratch.toggle(thescratchdrawer, made on first use) andpane.dock.left|right|bottomare the app's own, in the palette andleon actions, with default keys in docs/shortcuts.md. Not yet:pane.minimize_floating, since hiding a float without a label needs a server method. - Focus back. A float or drawer that a toggle (
leon toggle, ⌘J, a popup key) creates or shows remembers the pane of the active tab the toggle came from (State::back_to, in memory only). When it hides by a toggle or closes (its program exited) while it has the focus, that pane gets the focus again, in its own tab, if it is still shown; else the usual pick. Showing it another way (the switcher,leon float) forgets the pane. One popup per label per session: a toggle from a pane in another directory shows the popup already running, where it was made. - Going there. The switcher lists every float and drawer as a block row (by label, else
title, else program;
· hiddenwhen hidden). Going to one, or to an Activity row, issession.focus_block, which shows and raises a hidden overlay first.