Galaxy Shell / docs
Docs / Decisions and plans

Cell grid tiling inside a workspace: specification (2026-10-31)

openspec/specs/tiling-spec/spec.md · Edit on GitHub ↗

This document records decisions, plans or evidence from a project stage. It does not imply that every item is implemented or validated in the current version.

On this page

Cell grid tiling inside a workspace: specification (2026-10-31)

Purpose

Each workspace is a fixed grid of cells where each tiled window covers a rectangle of whole cells, placed, moved and resized with the keyboard and the mouse.

Requirements

Requirement: Whole cells, no overlap

The system SHALL give each tiled window a rectangle of whole cells with width >= 1 and height >= 1 inside the grid, and two tiled windows MUST NOT cover the same cell. Full text: section Model.

Scenario: Two windows

  • WHEN two tiled windows are placed
  • THEN no cell belongs to both

Requirement: Out of scope

The system SHALL NOT implement dragging windows between overview cards, an infinite or scrolling canvas in this spec, or a native UI in Smithay. Full text: section Goal.

Scenario: Overview drag

  • WHEN a window is dragged between overview cards
  • THEN this is rejected by the architecture decisions

Requirement: Grid fills itself when windows come or leave

The system SHALL fill the grid again when an application window comes or leaves, keeping the window order (top left to bottom right); held windows keep their cells, and when no cell is left the window floats. Full text: section Placement of a new window.

Scenario: New window

  • WHEN a window opens or returns to the grid
  • THEN the grid fills again with the new window last and no cell free

Requirement: Minimum client size

The system SHALL never give a window less than the minimum size of its client, turned into cells with gaps included, in every placement (the fill, a split, a drop, a resize, place and the login restore). Full text: section Placement of a new window.

Scenario: Even arrangement does not fit

  • WHEN the even arrangement does not fit the minimum sizes
  • THEN the fill takes the most even arrangement that does

Requirement: Close and removal refill

The system SHALL fill the grid again the same way when a tiled window closes, is minimized, floats, or moves to another workspace or output; the chat does not count as a window that comes or leaves. Cells given on purpose stay until the next window comes or leaves. Full text: section Closing and removal.

Scenario: Close during zoom

  • WHEN a tiled window closes
  • THEN a zoom is kept, while a new window and Super+G end it

Requirement: The chat never covers less than 2 x 2 cells

The system SHALL ignore a move, a shrink or a neighbor's grow that would make the chat smaller than 2 x 2 cells, and a new window that would split it below 2 x 2 cells MUST take another rule. This applies to a chat that holds cells (the output chat of a Grid workspace on an extra output); the primary chat on Grid holds no cells since 2026-11-03. Each workspace keeps exactly one chat. Full text: section The chat window.

Scenario: Shrinking the chat

  • WHEN a shrink would take the chat below 2 x 2 cells
  • THEN it does nothing

Requirement: Primary chat floats on the Grid

The system SHALL draw the primary chat on a Grid workspace of the primary output as a floating chat that holds no cells, centered at crate::canvas::dock(content), with the chat glass being the dock glass. Full text: section The chat window.

Scenario: Press outside the chat

  • WHEN the user presses outside the shown chat, except during an approval
  • THEN the chat hides

Requirement: Grid keys do not fire the Super tap

The system SHALL use Super+Alt and Super+Ctrl for the grid keys, a free cell MUST NOT be a focus target, and the Super tap MUST NOT fire after any of these combinations. Full text: section Keyboard.

Scenario: Grid key combination

  • WHEN the user presses a grid key combination
  • THEN the chat does not get the keyboard on release

Requirement: Move, grow and shrink collisions

The system SHALL swap a moved window with exactly one other window only when that window fits in the cells the moved window leaves, otherwise the move does nothing; a grow takes cells from neighbors only when each keeps at least one cell; a window never shrinks below one cell. Full text: section Collisions.

Scenario: Refused grow

  • WHEN a neighbor would be left with no cell
  • THEN the grow does nothing

Requirement: Floating windows

The system SHALL keep a floating window above the tiled windows of its workspace covering no cell, float dialogs (xdg parent) above their parent without entering the grid, and open windows with a fixed size floating. Full text: section Floating windows.

Scenario: Return to the grid

  • WHEN a window returns from floating to tiled
  • THEN it is placed as a new window

Requirement: Mouse drag rules

The system SHALL move a window on a title bar or Super+left drag with an outline of the target cells, resize by whole cells on an edge or Super+right drag, and make the window float at the drop position when Shift is held. Full text: section Mouse.

Scenario: Press with no motion

  • WHEN a press has no motion
  • THEN the window keeps its cells

Requirement: Outputs

The system SHALL keep the chat on the primary output, place a window that Super+Shift+Left/Right moves to another output as a new window, and return the windows of a disappeared output to the primary output as new windows. A pointer drop on another output takes the largest free rectangle containing the cell under the pointer, or a new window if that cell is held or no rectangle contains it. Full text: section Outputs.

Scenario: Output removed

  • WHEN an output disappears
  • THEN its windows are placed on the grid of the active workspace as new windows

Requirement: Held windows and agent tools

The system SHALL keep the cells of a window with userHeld=true, the agent cannot move it, and generated HTML gets none of the typed window_action set place, toggle_floating, fill_grid. The same refusals apply: held windows, shell windows, a locked session. Full text: section Agent tools and state.

Scenario: Agent grid action

  • WHEN a grid action could move a held window
  • THEN the core refuses it

Requirement: Grid persistence

The system SHALL save the cell rectangle and app id of each tiled window across logins, best effort, restoring a saved rectangle only if its cells are free; other windows are placed as new windows. Full text: section Persistence.

Scenario: Refused layout

  • WHEN a saved layout is refused on restore
  • THEN it is an entry in sessionRestore.errors and the restore is not blocked

Status

Doc status: current contract. Phases 1 to 5 implemented; deviations are in docs/smithay-development.md and openspec/specs/grid-on-canvas/spec.md. Checked 2026-11-10.

Introduction

Status: approved by the user on 2026-10-31. Phases 1 to 5 are implemented (see Smithay development for the current contract and its deviations). The user chose a spatial cell grid, not a binary tree, and accepted the recommendation of each decision D1 to D6. Each decision keeps its alternative for the record.

Goal

Each workspace is a fixed grid of cells. Each tiled window covers a rectangle of whole cells. Two tiled windows never cover the same cell. The user places, moves and resizes windows on the grid with the keyboard and the mouse. Since 2026-11-04 the grid fills itself again when an application window comes or leaves; cells given on purpose stay until that happens. A free cell exists only until then.

Out of scope:

  • Dragging windows between overview cards. This is rejected (architecture decisions).
  • An infinite or scrolling canvas. History: on 2026-11-01 the user asked for it as a separate Canvas layout, see canvas windows. This spec covers only the Grid layout.
  • A native UI in Smithay. The cell outline during a drag and the focus mark use the existing window finish shader; menus and hints stay web-based.

Current state

  • Layout in native/smithay/src/desktop.rs: Floating, Tile, Focus (default), Monocle, Pair. Each workspace has its own layout.
  • Tile is a fixed grid of ceil(sqrt(n)) columns with 8 px gaps (rectangles in desktop/layout.rs). The compositor computes it again for every change, and the user cannot change it.
  • Focus uses the presentations of focus.rs: Chat, Immersive, Sidebar, Palette.
  • Only the agent changes the layout (arrange_windows).
  • Work in progress: per-window floating with mouse move and resize.

Grid on the canvas model (2026-11-03)

The Grid draws and hit tests its windows through the canvas projection with a locked camera at zoom 1 (crate::canvas::locked_project), so its placement is unchanged to the pixel and windows are still configured at their cell size. A Grid workspace is not Layout::Canvas. See grid-on-canvas.md.

Model

A new layout grid replaces Tile.

  • The grid covers the content area of the output: the area without the top bar and the bottom bar strips.
  • The grid has columns × rows cells of equal size. Gaps: 8 px between windows and at the edges, as today.
  • A tiled window has a cell rectangle {col, row, width, height} in cells, with width >= 1 and height >= 1, inside the grid.
  • No cell belongs to two windows.
  • Each workspace keeps its own placements. Each extra output has one grid for its static area, shared by all workspaces.

(Since 2026-11-01 this applies to the Grid layout only, see canvas windows.) Decision D1: grid size. Chosen: 6 columns × 4 rows on every output. Six columns give halves, thirds and sixths; four rows give halves and quarters. Alternatives: 4 × 3 (bigger steps, fewer key presses), or a size per output that follows its aspect ratio.

Placement of a new window

Since 2026-11-04 a window that opens or returns to the grid fills the grid again, as Super+G: the windows keep their order (top left to bottom right), the new window comes last, and the last row shares its width, so no cell stays free. Held windows keep their cells and the others share the rest. When no cell is left for the window, it floats. The user chose this for "ordenar grade automaticamente" knowing that it changes positions chosen by hand.

A window never covers less than the minimum size of its client (2026-11-04, the user: "respeitar"). The compositor turns that size into cells, gaps included, on the grid without the margin of a whole chat. Every placement follows it: the fill, a split, a drop, a resize, place and the login restore. When the even arrangement does not fit, the fill takes the most even arrangement that does, with the windows in order: cuts split the grid in two, and the lowest sum of squared areas wins. When none fits, each window in order stays if it fits with the ones before it, and floats at its minimum size if not. Around held windows the windows take the even slots when they fit, the most even arrangement when the free cells are one rectangle, and each a place as new otherwise. A client whose minimum grows past its cells fills the grid again, unless the user holds it. Limits: while the whole chat shows, the grid is narrower and a wide window can still be clipped until the chat hides, because the chat must not rearrange the grid; a search takes at most 12 windows, and past that the rest float when the even arrangement does not fit.

The rules below still place the chat on an extra output, a window that a restore displaced, and the windows that a restore did not name:

  1. The window takes the largest free rectangle of cells. A tie goes to the rectangle nearest the focused window, then the top left one.
  2. With no free cell, the window splits the focused window: the focused window keeps one half of its rectangle, along its longer side, and the new window takes the other half.
  3. If the focused window covers only one cell, the window opens floating.

Closing and removal

When a tiled window closes, is minimized, floats, or moves to another workspace or output, the grid fills again the same way. A close keeps a zoom, while a new window and Super+G end it. The chat does not count as a window that comes or leaves, so a restart of the host moves nothing. Cells given on purpose (place, a drop, the login restore) stay until the next window comes or leaves. The fill runs at the next layout pass of a grid that shows: a window that opens or closes on a Canvas or on a workspace that does not show counts when its Grid shows.

Super+G fills the grid again: each window keeps its order (top left to bottom right), and the compositor gives the windows an even arrangement (the same result as the Tile layout of today, on cells).

The chat window

Current (2026-11-03): the chat floats on the Grid of the primary output. The user decided "no modo grid também pode manter o mesmo comportamento do card de não travar, ficar flutuante". On a Grid workspace that the primary output shows, the primary chat is no grid member and holds no cells: the application windows use the whole grid, and the chat draws centered at crate::canvas::dock(content) above them, as the floating chat of a Canvas workspace (floating_chat_in in desktop/canvas_mode.rs). A Super tap shows and focuses a hidden chat and hides a shown one; a hidden chat draws nothing and takes no input, and the focus repair moves the keyboard away. A press outside the shown chat hides it too (hide_chats_on_press, see the Click outside item of openspec/specs/canvas-windows/spec.md), except during an approval (chat_hold). The chat glass is the dock glass (chatGlass), never the chat regions. Differences from Canvas: a new Grid workspace starts with the chat shown, and a Canvas workspace that returns to Grid (Super+Shift+T, or the end of the canvas lease) shows it again. The Super+F zoom no longer hides the chat. The output chat of a Grid workspace on an extra output stays a tile, with the rules below (W8 of openspec/specs/multi-output-workspaces/spec.md); the primary chat holds no cells there either. When a workspace whose output chat held cells comes to the primary output, the grid fills again without them. The rest of this section is the earlier contract, which still applies to output chats.

(Since 2026-11-01 this applies to the Grid layout only, see canvas windows.) Decision D2: is the chat a tile? Chosen: yes (replaced for the primary chat on 2026-11-03, see above). In a new workspace the chat covers the whole grid. The first application window splits it, as in rule 2. The user can make the chat small or move it. Alternative: the chat keeps a fixed column on the left (like the Sidebar presentation) and only the other windows use the grid.

The chat never covers less than 2 × 2 cells: a move, a shrink or a neighbor's grow that would make it smaller does nothing. A new window that would split the chat below 2 × 2 cells takes another rule (rule 1, then the focused window if it is not the chat, else it opens floating).

When the chat returns and finds no cell by rule 1 or 2, the grid fills again with it. That fill is the placement of every window that waits in the same pass: no rule places them again. No fill gives cells to a fixed-size window without cells, also on Super+G and arrange_windows with layout grid: it floats and takes no cell from the fill.

Each workspace keeps exactly one chat, the conversation of that workspace. Several chats in one workspace are out of scope.

The Focus layout and its presentations stay available, so the user can go back to the chat-centered view of today.

(Since 2026-11-01 this applies to the Grid layout only, see canvas windows.) Decision D3: default layout of a new workspace. Chosen: grid. Alternative: keep Focus as the default and switch per workspace.

Keyboard

Super+←/→ (workspace), Super+Shift+←/→ (output), Super+1…9, Super+Enter, Super+Q, Super+L (lock) and Super+Escape already exist and stay the same. Super+S (the overview) is free of the grid keys; a Super tap gives the keyboard to the chat. The grid keys use Super+Alt and Super+Ctrl.

Keys Action
Super+Alt+←/→/↑/↓ moves the focus to the nearest window on that side
Super+Ctrl+←/→/↑/↓ moves the focused window by one cell
Super+Ctrl+Alt+→/↓ grows the focused window by one cell to the right / down
Super+Ctrl+Alt+←/↑ shrinks the focused window by one cell from the right / bottom
Super+Shift+Space toggles floating for the focused window
Super+F the focused window covers the whole grid, and back
Super+G fills the grid again (even arrangement)
Super+T switches the workspace between grid and Focus

"The nearest window on that side" is the window whose rectangle is on that side of the focused window and whose center is nearest. A free cell is never a focus target.

The Super tap (the chat gets the keyboard on release) must not fire after any of these combinations.

Decision D4: keys. Chosen: the table above. Alternative: Super+H/J/K/L for focus (vim style). That needs a new key for lock, because Super+L locks the session today.

Collisions

  • Move. If the target cells are free, the window moves. If the target cells hold exactly one other window, and that window fits in the cells that the moved window leaves, the two windows swap. Otherwise the move does nothing.
  • Grow. If the new cells are free, the window grows. If they belong to neighbor windows, each neighbor gives up that column or row, but only when each neighbor keeps at least one cell. Otherwise the grow does nothing.
  • Shrink. The freed cells stay free. A window never goes below one cell.

Mouse

(Since 2026-11-01 this applies to the Grid layout only, see canvas windows.) Decision D5: what a drag does. Chosen:

  • A drag of the client title bar, or Super+left drag, moves the window on the grid. An outline shows the target cells, and the drop follows the move collision rule.
  • The target of a move is the largest rectangle of free cells that contains the cell under the pointer (user decision of 2026-11-01). The cells the dragged window leaves count as free; held windows and the other windows are never inside it. A tie goes to the shape closest to the cells of the window, then to the rectangle nearest the pointer, then to the top left one. The rectangle keeps the minimum of the window (the chat 2 x 2). So a window that was shrunk to one column and is dragged to free cells takes all of them, also while the pointer stays over its own cells. A press with no motion keeps the cells. Over exactly one other window, or when no free rectangle with the minimum contains the pointer cell, the target is the cells of the window shifted by the pointer delta, with the move collision rule above (a swap or a refusal). The outline shows the same target as the drop.
  • A drag of a client edge, or Super+right drag, resizes the window by whole cells, with the grow rule.
  • Holding Shift during the drop makes the window float at the drop position instead.

Alternative: keep the earlier decision as it is, where any drag makes the window float, and change the grid only with the keyboard.

In the Focus layout a drag still makes the window float, as implemented on 2026-10-31 (see Smithay development).

Floating windows

  • A floating window stays above the tiled windows of its workspace and covers no cell.
  • Super+Shift+Space toggles the focused window between floating and tiled. A window that returns to the grid is placed as a new window.
  • Dialogs (windows with an xdg parent) float above their parent and never enter the grid.
  • Windows with a fixed size (min size equal to max size) open floating.
  • A tiled window whose min size is bigger than its cells is centered in its cells and clipped, as today.

Outputs

  • Each workspace grid belongs to the primary output.
  • Each extra output has one grid for its static area, shared by all workspaces.
  • Super+Shift+←/→ removes the window from its grid and places it on the grid of the target output as a new window.
  • A pointer move that ends on another output (title bar drag or Super+left drag) sends the window there, through the same path. A tile takes the largest free rectangle of that grid that contains the cell under the pointer (see D5); when that cell is held, or no free rectangle contains it, the window is placed as a new window (rules 1 to 3). A floating window, or any window dropped with Shift, keeps floating at the pointer position, clamped to the content area of that output. The outline shows the target on the grid of the output under the pointer. The chat never leaves the primary output, and the other refusals of a drag apply. A window that reaches the primary output joins the active workspace. A user drag may move a held window.
  • When an output disappears, its windows return to the primary output and are placed on the grid of the active workspace as new windows.
  • Behind the workspaceOutputs lease (openspec/specs/multi-output-workspaces/spec.md, phase 1), an extra output can show a workspace instead of its shared grid. The grid of that workspace then covers the whole extra output, and its windows keep their cells when the workspace moves between outputs. The cells of the primary chat stay reserved in that grid, and a new window splits them when no other window has cells. The windows of the shared grid hide meanwhile and keep their cells. While the lease is live, the grid keys and Super+T act on the workspace of the focus output. With the lease off, the rules above hold unchanged.

Agent tools and state

  • The state snapshot reports, per workspace, the layout and the grid size, and per window the cell rectangle (cells: {col,row,width,height}) or floating: true.
  • desktop_state passes these fields to the agent.
  • arrange_windows accepts layout: "grid" and keeps tile as an alias.
  • A new typed window_action set: place (a cell rectangle), toggle_floating, fill_grid. The same refusal rules as today apply: held windows, shell windows, a locked session. Generated HTML gets none of them.
  • A window with userHeld=true keeps its cells. The agent cannot move it. Implemented: the core refuses any grid action that could move a held window of the grid of the target, and sends its whole held set with each grid command, so every grid, the extra outputs included, keeps those cells. In the grid layout the core also refuses the agent expand and restore while a held window is zoomed (Super+F) on the grid of the target: they would replace or end that zoom. The core also sends the held set alone (set_held) after each take or release in the protected host, on each connection and when the held windows change, and with arrange_windows, only to a compositor that reports capabilities.heldSet. A held window without cells (back from floating or minimized, or on a new grid) is placed as a new window; no new window splits a held window. A fill shares the cells that held windows leave free evenly. When the held windows leave no free 2 × 2 rectangle, the held cells win over the chat minimum: see Cell grid tiling.
  • A grid action can leave windows floating without a request: a window that returns to a grid with no free cell for it (or with a fixed size) floats again (placement rule 3), and a fill floats the windows that find no cell. The compositor answers ok. The core compares floating before and after the answer and returns these windows in floated, with a note, as a success.

Persistence

(Since 2026-11-01 this applies to the Grid layout only, see canvas windows.) Decision D6: save the grid across logins. Chosen: yes, best effort. The core already keeps the workspace bindings of each window. It also saves the cell rectangle and the app id of each tiled window. At login, a window that matches an app id takes the first saved rectangle with that app id, if its cells are free. Other windows are placed as new windows. Alternative: no persistence; each login starts with an empty grid.

How the core does it (2026-11-01). The restore shows each saved workspace, with no animation, before it opens the windows of that workspace. Each window then maps on the grid of its own workspace, and the workspace that was active at login comes last. Before this change, every window opened on the active grid and split its chat. The bind then moved the window and left those cells free, so the chat of the active workspace kept half of the grid next to empty cells. A window that already runs at login is bound, not opened again. A workspace switch by the user during the restore ends the switches of the restore; the windows that are left open on the workspace that the compositor shows.

The record also keeps the layout of each workspace (workspaceLayouts, from the compositor snapshot), and the restore sends each one while its workspace shows. A workspace with no saved window keeps the default grid. The record stays at version 1 and keeps the single layout field for older cores. A record without workspaceLayouts and without cells comes from a compositor without the grid. Its focus layout is the old default, so the restore keeps the grid default of decision D3. The grid goes as tile on the wire, which a compositor without the grid also knows. A refused layout is an entry in sessionRestore.errors, not a blocked restore.

Since 2026-11-04 the grid has no free cell for a saved rectangle, so on a compositor with capabilities.gridRestore the core sends all the saved cells of a workspace in one grid_restore {placements, held}. A rectangle that is invalid, below the minimum of its window or over a held or an earlier window is skipped. A window in the way and a window with no saved rectangle take a place as new, so no fill follows. On an older compositor the core keeps place with only_free: true. The new core on an older compositor and the older core on the new compositor both work: with the older core a saved rectangle is refused and the window keeps its place in the even fill, as a refusal always did.

Order of each workspace (2026-11-01, minimize moved on 2026-11-04): the restore shows the workspace, sends its saved layout, opens or reuses and binds each window, replays minimize, places the saved cells, and replays maximize last. A minimize after the cells would be a window that leaves, and would fill the grid. Before this order, the replay ran right after each open, before the layout: a workspace saved as focus starts as grid (decision D3), so maximize became a grid zoom that layout focus left stale, and the app did not come back immersive. Every later open and every accepted place on the grid also ended a replayed zoom (Grid::place sets zoom = None), and the next save wrote maximized: false. A window that already runs on another workspace belongs to the workspace of the restore only after its bind, so a replay before the bind was refused as "Window belongs to an inactive workspace". A failed replay is an entry in sessionRestore.errors; the window keeps its saved workspace, and the restore goes on.

Deviations: the chat has no saved rectangle, and the core cannot place it (grid actions refuse shell windows). On each restored workspace the chat takes the grid first, and the first window splits it. A saved rectangle that overlaps the cells of the chat is refused, and that window keeps the cells of the grid. A window that the user holds keeps its cells, and each place carries the held set. A lost connection during placement is an error and ends the placement.

Rendering and motion

  • A grid change moves windows to their new rectangles with the existing window motion, if it is cheap. Otherwise the windows jump.
  • The focused window shows the focus mark of the window finish shader.
  • A client that does not take the new size in time is clipped to its cells, as today.
  • The overview cards and thumbnails draw the cell rectangles.

Acceptance

Rust tests:

  • placement of a new window (largest free rectangle, tie rules, split, one cell floats);
  • a window that comes or leaves fills the grid, and passes alone move nothing;
  • a close keeps the zoom, and the chat moves nothing;
  • grid_restore, and a floating window on occupied cells with only_free: false;
  • Super+G arrangement;
  • focus by side, and free cells are never targets;
  • move, swap and refused move;
  • grow with neighbors, refused grow, shrink;
  • floating toggle, dialogs, fixed-size windows;
  • the move between outputs and the removal of an output;
  • the state snapshot;
  • no Super tap after a grid key.

In-process Wayland clients with synthetic keys check each shortcut, and synthetic pointer drags check the snap.

Node tests cover the new tool actions and the refusals.

A real login with two monitors checks the keys, the drag snap and the persistence. These are separate steps: publish, build, next login.

Phases

  1. The grid model, placement, removal, focus and move keys, the floating toggle, Super+T, Super+G, and the state snapshot. Implemented.
  2. Grow and shrink keys, Super+F. Implemented.
  3. Mouse drag with the cell outline (D5). Implemented. The outline is a translucent rectangle that the compositor draws, not the window finish shader, which draws only on window pixels.
  4. The agent tool actions. Implemented.
  5. Persistence (D6). Implemented, best effort: the chat has no saved rectangle. On each restored workspace, the chat and the windows placed before often hold the saved cells. Since 2026-11-01 each window opens on its own workspace, and each workspace restores its own layout (see Persistence).