OpenProgram Docs

Center canvas layout

Each layout occupies one top-level tab. Any tab content fits a pane: chat, web page, terminal, file preview, program view. The real limit on panes is their minimum size. Floating windows belong to picture-in-picture; a pane is never shared across windows.

Layout tree

type LayoutNode =
  | { kind: "pane";  id: string; content: string | null }   // null = empty pane
  | { kind: "split"; id: string; dir: "row" | "col";
      children: LayoutNode[]; sizes: number[] };

type CanvasLayout = { root: LayoutNode; focusedPaneId: string; zoomedPaneId?: string };
RuleDetail
Normalisation, after each changeA split with one child becomes that child; a split with its parent's direction merges into it, weights multiplied; weights rescale and clamp to minimum size
ContentAppears once in a layout
MigrationA two-pane group becomes a row split with its saved ratio
Empty paneLists the strip's content; a click fills it
FocusOne pane; keyboard input, close, tiling shortcuts and right-sidebar context follow it
FillStretches a pane over the canvas; others stay mounted, hidden

Code: apps/web/lib/tabs/canvas/canvas-layout.ts.

Pane grip

No persistent toolbar and no title bar. A ••• grip sits top centre, with an 88×22px hit area. Pressing it never selects text and only prepares a drag: no store commit, focus or route change. A click focuses.

ButtonClickExtra
RedCloses the tab through the strip's closeNo menu
YellowPuts the pane back in the strip as its own tab; the session staysNo menu
GreenOpens the tab on its ownRest 250ms: attached tiling menu, folds when the pointer leaves. ↓ on green or right-click on the grip: pinned menu.

A press on a button that moves 6px becomes a drag and never clicks; pointer capture starts only with the drag. A closed pane leaves the layout in the click's frame and folds away as its neighbour grows into the space (Closing).

Grip motion
PartMotion
SheetUnder the pointer the grip drops a grey sheet from the top edge, shoulders flaring into it, growing from a sliver with a slight spring
DotsThe window buttons at rest: they spread, grow one after another into red, yellow and green, then their glyphs fade in
LeavingRuns it backwards
MenuGrows out of the sheet as the grip widens; closing, it stays drawn 200ms to fold up before the grip narrows

Tiling menu

Mirrors the macOS green-button menu with small layout glyphs. A hint line names the glyph under the pointer, otherwise says to hold Option for quarters. On macOS it also names the shortcut; on Windows and Linux the tiling keys do not exist, the line names none, and Option reads Alt.

GroupItems
Move and resize, this paneLeft, right, top, bottom halves; four quarters while Option is held. Others keep their order in the other half; a quarter fully held by another pane trades places.
Fill and arrangeFill; left and right; left and stacked right; quarters. This pane first, contents in reading order, overflow to the strip, spare panes empty.
Return to previous layoutLeaves Fill, then steps back past the last tile, arrange, drop, equalize, close or divider drag. Entries are found by any tab or group involved, so a pane pulled out can be put back.
Equalize sizesPanes take equal sizes
More layoutsTop and bottom, single, nine, sixteen, saved layouts, Save layout…

Shortcuts

KeysAction
⌃⌥ + arrowTile the focused pane to a half. Control + Option because Fn + Control is macOS's.
⌃⌥⇧ + arrowArrange left and right or top and bottom, focused pane on the arrow's side; alone, the other side is empty
⌃⌥F, ⌘⇧↩Toggle Fill
⌃⌥RReturn to previous layout
⌘\, ⌘⇧\Split right, split below
⌘WClose the focused pane in a multi-pane layout
⌥⌘ + arrowMove spatial focus

⌘ is Control on Windows and Linux.

Dividers

AspectBehaviour
LookNothing until the pointer rests on the gap, then a short grey pill in its middle. The whole gap drags.
MinimumStops where a pane would drop below 240×160px; a smaller pane is never squeezed further
SnapWithin 10px of a third, half or two thirds; shows the ratio
EqualizeDouble-click, adjacent pair
KeyboardArrows on a focused divider, 2% a step
Drag costpreviewCanvas repaints at most once a frame, in memory only; setCanvas commits once on release
Below 900pxWhile split, collapsed rails keep their columns so they never cover a pane

The split in the strip

A split window is one tab, as wide as any other, like Chrome's and Arc's split views: the focused pane's icon and title, a miniature of the split with that pane filled, and the pane count. Its close acts on the whole window.

A pane closed from a split that stays leaves the split's tab in the same tick as the click. When focus changes or a merge just formed the split, icon and name rise in over 200ms.

Window overview

Modelled on Mission Control and the iPad app switcher. The center area recedes to the page colour and every window in the strip becomes a card on a grid, as large as fits, never wider than half the area.

A card keeps its window's split, drawn from the same tree and geometry. Panes have no drop zones: on a visible canvas the bottom half and corners were hard to tell apart.

Opened byMode
A tab of the window on screen dragged out of the strip over that window (it cannot dock beside itself; back in the strip the overview closes), a grip starting to moveDrag
The button beside the main menu, pinching in on the center area or stripBrowse

Any other tab dragged out of the strip keeps the window on screen and docks beside it there (liveCanvasDropAt), with the same zones as a card below.

Beside, left Beside, right Above Below Calls dockCanvas with root and the side
Pointer overResult
Left or right quarterTab beside the whole window
Middle halfAbove or below, by the half under the pointer
Release onResult
The stripReorder; a pane returns to a standalone tab, with the same blue rounded preview as docking, following the strip's bounds
A card's zoneMerge with dockCanvas(sources, card tab, "root", side). A pane on its own window's card moves to that half. The card grows, the half highlights, a hint names window and side.
Empty spaceOpens on its own in the gap
Resources viewBinds the web page as a session resource
Beyond the windowDetaches into a new window
Escape, or back to the stripCancels; a plain reorder
InputResult
Click a cardSwitches to that window before the zoom, so the live window is ready underneath
Escape, pinch outZooms the current window back
Click outsideCloses
Click between cardsNothing
Press and move 6px on a card, browsingPicks up that window, or one pane of a split card, as a same-size copy; see-through over a card
Pinch on content that zoomsThe context graph keeps the gesture
Pinch in on a web pagemain/web-views/webtab-preload.js (isolated world, exposes nothing) opens the overview only if the gesture starts at visualViewport.scale 1. Pinching out magnifies natively, 1× to 3×; pinching in on a magnified page only zooms it back.

The overview covers only the center area and is a native-view occluder. As in Mission Control nothing marks the current window. Browsing keeps the hint's room, hidden.

Pictures on the cards
AspectBehaviour
StorePer tab, in memory and IndexedDB (lib/tabs/canvas/window-snapshots.ts), one theme only: a theme change drops them all and other-theme ones are not restored, since a card flashed against the live window. An empty tab list while the store loads never prunes.
TakenBefore any overview opens, the dragged tab's pane included (its preview hides); 900ms after a switch or layout change; when the App loses focus or hides; every 30s after 5s with no input
Page paneswindow:capture-region IPC, a window's main page capturing itself only; JPEG at most 720px wide
Web panesFrom their own views, so off-screen ones stay current. A view holds the page only, so an on-screen pane is pictured as its region with the page drawn into [data-web-frame]; the toolbar band is kept and frames off-screen pages, keeping the pane's proportions.
Card shapeIts window shrunk whole: a lone pane flush (1rem corners), split panes 1px inside their slots (16px corners), all at the card's scale so nothing jumps on landing
Clean contentGrips are hidden for the two frames before a capture
Never picturedOnly the tab's icon, centred; the name is the card's caption
Dragging over the overview
PartBehaviour
Source tab's slotdata-drag-out closes it by width (flex-basis, width, padding to 0, 8px gap taken back) in 160ms, so later tabs and + slide over. It stays closed through a merge or a move to another window; reopens with data-slot-reopen only when the tab stays.
Dragged tabA small window under the pointer: tab on top, last picture below, 240px wide, 110 to 190px tall, opening in 200ms, folding back in 140ms over the strip. Never pictured: stays a tab, opens if a picture arrives.
CardsThe tab leaves its own card; a card with no tab disappears; the card under the pointer grows slightly
Gapslot in the overview store, where the tab would stand alone. Starts at the dragged window, or just after the window a pane leaves. Cards are sized for cards plus gap, so a pick-up resizes nothing. Off the cards it stays while nearer than any card, else goes beside the nearest card on the pointer's side; distances use layout offsets, without framer-motion transforms. Outlined over empty space.
Drop in the gapCarries before; commitCanvasDrop calls moveTab (after ungrouping a pane) or moveGroup, so the strip takes the overview's order. Only a pane out of a split is activated. The overview stays open browsing: holdOverviewLanding, then sourceIds clears and the tab's card returns.
Dragging a cardGoes through overviewDropAt like any drag: a card's side merges, empty space moves the window to its gap (a pane gets its own window), anything but a merge browses on (browseOverview); Escape cancels.
ModesSame area and buttons, so pictures survive a switch; no replayed fade (data-opened-as); empty space tints only the hint
MotionOpen or close zoom is a framer-motion layout animation, 340ms, a placeholder holding the slot; drag overviews fade in. Grid changes use a layout spring; new cards grow in where they land, only on mount.
Strip after a mergeplaceDockedTabs moves docked tabs before the window they join, so the split keeps that window's slot
Landing a merge

One zoom, begun at the release. The commit waits on the desktop shell's transfer cancel (about 50ms) and a render of the split (about 40ms), so waiting would show a gone window and an unchanged card for some 90ms.

  1. The release holds the overview, notes the drop and tabs, and sets landing. The target card grows from its grid place over the center area in 340ms, one uniform-scale transform that plays through the wait. Its window activates underneath, so panes are loaded by the time they make room.
  2. commitCanvasDrop hands the merge to landOverview, which holds it and marks landed.
  3. Landed and under way (about a tenth of a second in), the overview reads each pane's rect in the zooming card, converts to the canvas's unscaled frame, and passes rects plus zoom start, curve and progress to captureCanvasLanding.
  4. It closes, applying the merge in the same tick. A fallback timer applies it too, unanimated.
  5. The shell plays the capture: panes animate real geometry into the split; the docked tab enters from the drop side at final size, translated out and clipped at the canvas edge (clip-path), same 300ms, so the seam moves as one and content never re-wraps.
  6. Measured unscaled first, the canvas root takes over the zoom with the same keyframes and the card animation's own startTime, one clock, on live content rather than blurry JPEGs.
DetailRule
startTimeSet explicitly at creation: a compositor animation otherwise stays pending to the main thread
data-canvas-landingKeeps the centre column open page meanwhile
Other cardsFade in 80ms; the hint fades but keeps its room, so the grid does not re-centre
Failed mergeThe shell keeps the tab: the overview closes at once

Layout animation

Rearranging animates as macOS moves windows: green, the tiling menu, Fill, Return to previous layout and a drop (lib/tabs/canvas/canvas-transition.ts). Closing a pane animates too (Closing). Reduce Motion skips it; divider drags do not animate.

PaneAnimation
StaysReal geometry (left, top, width, height) through Web Animations, 300ms, so text re-wraps; inline calc() untouched
ArrivesFades in
HiddenA pane that green, Fill or an arrangement with fewer panes hides fades under the one growing over it
ClosedFolds toward the side it stood on, clipped (clip-path) on the same 300ms curve as the pane growing into its room, so the edge between them moves as one
How it plays
PartDetail
RecordJust before a change the canvas records each pane's rect by tab id and keeps a still copy. The shell plays it in the layout effect of the committing render, before paint. A record no commit follows lapses after 1.5s.
MatchingBy tab id, so a session moving from peer pane to lone chat shell still animates. The hidden shell switches to the remaining session in the layout's tick, not renders later.
TranscriptsFade in only when rows arrive after a switch; a message row's appear animation runs only within a second of arrival, so remounts show as they are
During the moveCounts as dragging: web panes show snapshots, chats re-wrap rows in view only; frames and dividers fade out and back

Closing

Red and yellow change the layout in the click's frame: the tab, the strip and the focus are final at once. On the canvas the closed pane then folds away while its neighbours grow into its room. Nothing waits for the animation, and nothing waits for a save.

PartDetail
LayoutOne store commit removes the pane. The capture taken just before it copies only the closing pane, never the chat beside it.
FoldToward the side away from the pane that takes the room: a right pane folds to the right edge, a bottom pane to the bottom. A pane nobody grows into fades instead.
Web panesShow snapshots for the 300ms, as in any layout animation. The closed tab's view is destroyed after the commit (destroyStaleWebViews).
FilesThe tab goes at once whatever the document needs. Its pane stays mounted out of sight (lib/tabs/panes/held-file-panes.ts), folding first where it stood, until the document is saved and its editor closed.
A save that failsShows a toast with Open and never brings the pane back by itself: the file may have moved or changed on disk. The edit stays in the draft store and is offered when the file opens.
Unchanged filesClosing writes only changes the editor reported. A file nobody changed is closed without writing anything back over it.
Unsaved changesEdits the file does not hold yet (a draft, an Office edit not yet exported, a failed save) are asked about first, as PowerPoint asks: Save, Don't Save or Cancel. One question covers every file the close takes.
Don't SaveDrops the draft and the editor's edits; nothing is written. Cancel keeps the tab.
Reopened meanwhileThe same file opened again while that release runs gets a fresh document, which the release never closes
ProgramsThe application's close request is sent without waiting for it
Chat beside itMoves from its peer pane to the chat shell under the same tab id, so it grows from where it stood

Why a save never holds the close: an Office deck is exported whole and uploaded on close, which takes seconds, and a file that an agent moved or rewrote meanwhile cannot be saved at all, which left a pane that could not be closed.

Drag lifecycle

The canvas will host many small app windows, so every drag ends cleanly and leaves other panes alone.

CaseHandling
Any endRelease, Escape, pointercancel, window blur or a drop-lookup error run one cleanup once: label and cue go, grip returns, capture released, data-canvas-dragging cleared. A failed lookup is no drop.
Missed releaseOver the window-drag strip, a native view or another app the page gets no pointerup. Each drag registers with setCanvasDragging(true, owner); the first pointermove with no button down is the release; a new press cancels the old drag. No -webkit-app-region: drag while dragging.
Grip statedata-pane-dragging hides it through CSS, never inline; a new drag clears any stale one
Native web viewCaptured first, hidden on arrival or after 160ms, so no paused card flashes
Drop cueNo backdrop blur; 120ms ease-out with no overshoot

Rendering and native views

  • Recursive geometry feeds stable content hosts: tree edits and zoom do not reparent file editors, terminals or sessions.
  • A pane under 150×110px shows its title and type with a zoom action.
  • Each web pane reports its own bounds (registerVisibleWebTabBounds). While dragging, undersized, or beyond eight visible native views, a pane shows its captured image. Selecting a paused view gives it priority. Hidden views stay alive; no process ends.

Persistence

The window's tab payload stores each group's tree, focus and zoom, with tab references only. Missing references become empty panes. Cross-window payload validation bounds tree depth, node count and serialized size independently of the layout editor. Resources attachment uses its existing backend ownership operation.

Implementation status

Implemented: everything above.

Last updated · 2026-11-25