Galaxy Shell / docs
Docs / Architecture and development

Window layers and declarations

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

On this page

Window layers and declarations

Purpose

Gives every host window (chat, bars, wallpaper, panels, lock, recovery) one typed declaration with a band and a role, so protected surfaces stay above and unimitable and no title gives a role. This spec holds the landed behavior.

Requirements

Requirement: Declarations only on the host connection

The compositor SHALL take window_declare, window_forget and window_status only on the host connection. Any other process is refused. Full text: section Binding contract (from AGENTS.md).

Scenario: Declare from another connection

  • WHEN a connection that is not the host connection sends window_declare
  • THEN the compositor refuses it

Requirement: Declarations come only from main-key routes

The core SHALL send declarations only for the main-key routes /host-window and /host-window-forget, which the Electron main process calls with the host main key in a header; the launch key MUST NOT open them. The core builds every declaration from its own templates and registry. Full text: section Binding contract (from AGENTS.md).

Scenario: Launch key on /host-window

  • WHEN a caller presents only the launch key
  • THEN the route is not opened

Requirement: No agent or page declares a window

No agent tool, generated HTML or trusted page SHALL declare, change or forget a window, a title or a token. Full text: section Binding contract (from AGENTS.md).

Scenario: Trusted page tries to declare

  • WHEN a trusted page tries to declare or forget a window
  • THEN it cannot

Requirement: No title gives a role

No title SHALL give a role: a host window that did not bind is an unbound root below the chat, the same title from another client is an ordinary application, and a shell lock is refused without a live lock token. Full text: section Binding contract (from AGENTS.md).

Scenario: Host window fails to bind

  • WHEN a host window does not bind to a declaration
  • THEN it stays an unbound root below the chat

Requirement: Isolated panels choose only a limited set of fields

An isolated panel of web-panels.json SHALL choose only the desktop or hud band (below the chat), its order 0 to 15, its space (screen or canvas) and its input. The compositor MUST refuse any other band for it, and a protected panel takes none of these fields. Full text: section Binding contract (from AGENTS.md).

Scenario: Plugin asks for chrome

  • WHEN a plugin declares the chrome band
  • THEN the compositor refuses it

Requirement: No plugin draws above the chat or takes its input

No plugin SHALL draw above the chat or take its input. Above the shell band only raised (derived by the compositor, never declared), chrome, overlay and lock exist, and only the host connection can declare chrome, overlay and lock, for the core's own built-in surfaces. Full text: section Binding contract (from AGENTS.md).

Scenario: Plugin overlaps the composer

  • WHEN a plugin window overlaps the composer
  • THEN the chat stays above it and keeps the input

The compositor SHALL bind a toplevel to a declaration only when it is a root, its client is the registered host, it has not committed a buffer, its whole title equals a live token, and no other live window is bound to that token. A bound window stays bound and an unbound one stays undeclared for life; after the bind the compositor never reads the title for any rule. Full text: section The window link.

Scenario: Late token title

  • WHEN a window that already committed a buffer gets a token title
  • THEN it stays undeclared and counts in windowDeclarations.lateBinds

Requirement: Band table and role-only properties

The compositor SHALL check the band table for each window_declare, whatever the core sends: isolated plugins get only desktop or hud, and the properties keyboard exclusive, exclusive, camera_exclusive, paints_workspaces and with_top_bar are refused with "Property not allowed for this role" on any other role, and so are autohide and reserve on any role but a bar at the bottom edge. Full text: section Who may set what.

Scenario: Plugin with keyboard exclusive

  • WHEN a declaration of role panel asks for keyboard: exclusive
  • THEN it is refused with Property not allowed for this role

Requirement: The main key stays out of reach

The host main key SHALL NOT go into a cookie, a URL, a log, a renderer or the environment, and the host routes /host-window, /host-window-update and /host-window-forget MUST accept only this key, in a header. Full text: section Who may set what.

Scenario: Renderer calls the route

  • WHEN a trusted renderer calls /host-window with the launch cookie
  • THEN the route does not accept it

Requirement: Plugin placement fields are validated

A protected panel SHALL have layer, order, space and input refused in web-panels.json, and an isolated plugin MUST stay on area output with confine content, so it never covers the bars. The parser refuses the whole file on any error and keeps the last valid set. Full text: section Plugin fields in web-panels.json.

Scenario: Protected panel sets layer

  • WHEN a protected panel entry sets layer
  • THEN the file is refused as a whole and the last valid set stays

Requirement: Plugins do not take focus under a higher band

An on_show focus or a focus by command SHALL go to a desktop or hud window only when no visible window of a higher band intersects its rectangle; otherwise the keyboard stays where it is. A click reaches the topmost surface at the pointer. Full text: section The rule that keeps the protected surfaces above and unimitable.

Scenario: Plugin shown under the chat

  • WHEN a keyboard plugin is shown while the chat covers it
  • THEN the keyboard stays on the chat

Requirement: The compositor reads the title only for listed reasons

The compositor SHALL read the title only to compare a token before the first buffer, to read the paint marker of the role chat, and to report the title of an undeclared window in the snapshot (empty for a host window with a token title). A grep gate test scans for any new read. Full text: section Security rules.

Scenario: Host window with token title unbound

  • WHEN an undeclared host window has a token title
  • THEN the snapshot reports an empty title

Requirement: The token is not a secret and safety does not rest on it

The token SHALL be 128 random bits used as a correlation id, and the snapshot, the logs and the agent tools MUST NOT repeat it. Safety rests on host-only declaration and the exact bind rules, never on the token being unknown. Full text: section Security rules.

Scenario: Process reads the token

  • WHEN a user process reads the token from AT-SPI
  • THEN it still cannot declare or bind without the host connection

Requirement: Lock and recovery stay out of reach

The lock and recovery SHALL stay in bands that no plugin or application reaches, and the lock scene stays the only scene while locked. Full text: section Security rules.

Scenario: Locked session

  • WHEN the session is locked
  • THEN only the lock scene is drawn

Requirement: The security rules bind agents, not the user's own processes

The rules SHALL bind applications, plugins, generated HTML and agent tools; they are advisory against a process that execute_command starts, which can still kill or trace the host and the core. Full text: section Security rules.

Scenario: execute_command process

  • WHEN a process started by execute_command acts as the user
  • THEN these rules do not stop it

Status

Doc status: partly landed. Landed: phases 0 to 4 (compositor roles and declarations, no title gives a role). Not landed: /host-window-status, lockBound and the runtime repair of an unbound window. Checked 2026-11-10.

Purpose and scope

In scope

  • One declaration model for every host window: the chat, the two bars, the wallpaper, the web panels (protected and isolated), the lock window and the recovery window.
  • The explicit window link with no title rule.
  • Plugin fields in web-panels.json for layer, order, space, anchor, input and keyboard, validated on both sides.
  • The migration of every compositor and core consumer of the title predicates.
  • The chat dock as an anchored placement.

Out of scope

  • wlr-layer-shell. Electron does not speak it. It is a design reference only (see wlr-layer-shell as a reference).
  • Binding the other host commands (bar_glass, chat_glass, chat_dock, chat_dock_side, overview_planes) to the host connection. See open question 9.
  • Per-workspace plugins and plugin exclusive zones (open questions 6 and 7).
  • Any native UI in Smithay. All visual parts stay web (docs/architecture-decisions.md, openspec/changes/archive/2026-10-27-ui-compositor-rendering/design.md).
  • Dragging windows between overview cards. It is never implemented (AGENTS.md).

Proposed model

Bands

A band is a fixed range of the stack. The compositor sorts presentations by (band, order) with a stable sort, so inside one (band, order) the Space order with raise on focus stays as today (desktop.rs:1337).

Band Key Who gets it Today
background 0 the wallpaper (host only) 0
desktop 1 plugins that ask for it: widgets under the applications none
app 2 undeclared windows (derived, never declared) 1
floating 3 floating undeclared windows (derived) 2
hud 4 plugins (the default band of an isolated plugin) none
unbound 5 from phase 4, an undeclared host-owned root (derived, never declared; see Snapshot fields) none
shell 6 the chat and the recovery window (host only) 3
raised 7 the chat in Palette and the window of a thumbnail motion (derived, never declared) 4
chrome 8 the bars (host only) 5
overlay 9 the protected panels (host only) 6
lock 10 the lock window (host only; drawn only by the lock scene) 6
  • order is 0 to 15. A plugin sets it to add its own layer inside its band: order 3 draws above order 2 of the same band. Host declarations use 0.
  • A dialog takes the band and the order of its root, as stacking_key does today with root_under.
  • The relative order of today's keys stays the same. The bands desktop and hud are empty until a plugin asks for them, and unbound is empty until phase 4 and then holds only a host window that did not bind.

Properties of a declaration

Property Values Meaning
role chat, wallpaper, bar, panel, lock, recovery The kind of host surface. The roles keep the behavior that is more than stacking (see What stays special).
name 1 to 256 characters The display name. The snapshot reports it as the title of the window.
layer a band from the table, without app, floating, unbound and raised The band.
order 0 to 15 The layer inside the band.
space screen or canvas screen: fixed to the primary output, outside the camera. canvas: drawn through the camera of the active Canvas workspace. Undeclared windows are canvas in a Canvas workspace, as today.
placement an anchored placement, a canvas rectangle, layout or dock Where the window goes (see Placement).
input normal or none none: the compositor never hit-tests the window, as the wallpaper today.
keyboard none, on_demand, on_show, exclusive none: never a keyboard target. on_demand: a target on click or command. on_show: also takes the keyboard when its toplevel first shows. exclusive: the lock only.
exclusive 0 to 256 pixels A strip that the layouts leave free at the anchored edge (the bars: 40 at the bottom, 32 at the top). A bar that declares 0 and no autohide still takes the default strip of its edge (40 pixels at the bottom).
autohide intellihide or none A bar at the bottom edge only (the app dock of the theme Lumen, change dock-theme). The compositor hides the bar of an output while an application window drawn on that output intersects its region, and shows it otherwise. A bar with autohide contributes only its exclusive to every strip, 0 for the app dock, so it has no strip and overlaps the content area at the edge: no default height applies to it. Needs capabilities.appDockAutohide. See The app dock bar.
reserve 0 to 256 pixels A bar at the bottom edge only. The height, from the bottom edge of its output, that the box of the chat, the whole chat, the Grid cells and the protected panels anchored at the bottom leave free. A maximized window, a floating window and a Canvas window ignore it and reach the edge.
camera_exclusive an edge or none (as built in phase 3: dock or none) The camera fit viewport leaves out this window and a 12 px margin on that edge. dock (the chat only): in Canvas the dock state gives the edge and the rectangle. Since 2026-11-02 the chat floats centered and dock takes nothing; the value stays valid.
glass {enabled, blur 0-24, radius 0-64} or none The backdrop material of a panel, as the panel glass today. The bars and the chat declare none: bar_glass (the bottom bar only) and chat_glass stay their own commands.
panel {id, trust: protected or isolated} For role panel only.
paints_workspaces true or false For role chat only (see The paint marker).

Placement

An anchored placement (screen space):

{
  "area": "output" | "content",
  "anchor": "top-left" | "top" | "top-right" | "left" | "center" | "right" | "bottom-left" | "bottom" | "bottom-right",
  "margin": [top, right, bottom, left],
  "width": {"px": n} | {"client": {"min": a, "max": b}} | {"fraction": f, "min": a, "max": b} | {"fill": true},
  "height": the same forms,
  "clamp": "size" | "margin",
  "confine": "content" | none,
  "with_top_bar": {"anchor": ..., "margin": [...]}
}
  • content is the area between the declared exclusive strips (today desktop_strips, desktop/layout.rs:598-630). output is the whole primary output.
  • One solver computes every rectangle. For each axis: a px size is fixed; a client size is max while the client has committed no size yet (size 0, as on the initial bufferless commit where place_web_panel solves, handlers/compositor.rs:52-54), and otherwise the size that the client commits, held in [min, max] (the fit_content rule, rectangle_with_client, web_panels.rs:132-147); a fraction size is area * f held in [min, max]; a fill size is the whole area axis minus both margins of that axis, with no 4096 cap, as apply_layout and desktop_strips use the full area width today (desktop/layout.rs:371-391, 598-630).
  • clamp says what gives way when the size and the margins do not fit in the area. The two old functions do it in opposite ways, and the solver keeps both:
    • size (the default; the bars, the chat dock, the wallpaper, the lock and the recovery window): each size is held to the area minus both margins of that axis, as canvas::dock does (canvas.rs:440-462).
    • margin (every web panel, protected or isolated): each size is held to the area, then each margin is held to the area minus the size, as rectangle_with_client does (dx = offset_x.min(area.w - width), web_panels.rs:150-151). Example: a 580 px high panel with a 20 px margin on a 600 px area keeps its height of 580 and gets a margin of 20, where size would give 560.
  • An edge or corner anchor puts the window at the margin of that edge. A centered axis ignores its margins.
  • confine: content is a last step after the solve: the solver holds the size to the content area, then moves the rectangle into it, as Panel::placement does today for an isolated panel (web_panels.rs:211-229). So the anchor and the margins of an isolated plugin are measured from the output edge, as its offsets are today, and the plugin still never covers the bars. Example, with both bars: a top-right plugin with offset_y 40 is at y=40 (the content area starts at 32), and a bottom-right plugin with offset_y 40 sits flush on the bottom bar. Only the core sets confine, and only for isolated plugins.
  • with_top_bar is an optional second anchor and margin. The compositor uses it, at each layout pass, while a bound top bar (role bar, top edge) is mapped, and the main anchor otherwise. This keeps the runtime switch of today: rectangle_with_client reads top_bar at each placement (web_panels.rs:127-131, desktop/layout.rs:272-274). Only the core sets it, for the protected defaults below. A plugin cannot set it.
  • Values: margins 0 to 2048, px and bounds 1 to 4096, fraction from 0.05 to 1.0. fill has no bound. A test solves the wallpaper, both bars, the lock window and the expanded dock on an output wider than 4096 logical pixels (for example 5120x1440) and checks that each reaches the output or area edge, as today.

A canvas rectangle (canvas space, plugins only):

{"canvas": {"x": -65536..65536, "y": -65536..65536, "width": 1..4096, "height": 1..4096}}

layout means that the current layout places the window (the chat in Grid, Focus, Floating, Monocle and Pair). dock means the chat dock in Canvas (see The chat dock).

Declarations of the host windows

These are the declarations of phase 2. With the clamp modes and with_top_bar above, they give the current look on every output size.

Window role layer space placement input keyboard other
Wallpaper wallpaper background screen output, top-left, width and height fill none none
Bottom bar bar chrome screen output, bottom, width fill, height px 40 normal none exclusive 40
App dock bar (theme Lumen, autohide only on a compositor with appDockAutohide) bar chrome screen output, bottom, width fill, height px 80 normal none exclusive 0, autohide intellihide, reserve 80 (native/smithay/testdata/host-declarations.json, app-dock-bar); without the capability the core declares exclusive 80 and no autohide or reserve
Top bar bar chrome screen output, top, width fill, height px 32 normal none exclusive 32
Chat chat shell screen layout; dock in Canvas normal on_demand paints_workspaces; camera_exclusive dock from phase 3 (the phase 2 chat declares none; native/smithay/testdata/host-declarations.json has the phase 3 chat)
Recovery recovery shell screen content, center, client size up to 1280x900 normal on_show
Protected panel panel (protected) overlay screen from web-panels.json, area output, no confine, see Protected panel defaults normal (none for the volume indicator) from keyboard glass
Isolated plugin panel (isolated) hud by default (overlay before phase 3) from the file from the file, area output, clamp margin, confine content from the file from keyboard glass
Lock window lock lock screen output, top-left, width and height fill normal exclusive

Recovery is a change of behavior on purpose. Today it is an ordinary window under any application. In the shell band it is centered, global and above applications and plugins, like the chat. AGENTS.md lists recovery as a protected surface, so it must not be coverable.

Protected panel defaults

The per-id rules of web_panels.rs:116-196 are copied to the core (web-shell/core/web-panels.cjs) in phase 2. The Rust rules stay for the title fallback of undeclared windows until phase 4, because an older host on a phase 1 to 3 compositor needs them (see Version skew). Phase 4 removed them with web_panels.rs. The core turns the exact legacy values into explicit anchors and margins, all with clamp: margin:

  • quick-settings with offset_x 0 and either anchor top-right with offset_y 40 or 32 (the top bar height), or anchor bottom-right with offset_y 40: the main anchor and margins are the declared ones, and with_top_bar is anchor top-right, margins [44, 0, 0, 0] (40 + 4).
  • notification-center with the same anchor and offset condition: the main anchor and margins are the declared ones, and with_top_bar is anchor top, margins [44, 0, 0, 0].
  • notifications with (top-right, 0, 40) or (bottom-right, 8, 48): the main anchor and margins are the declared ones, and with_top_bar is anchor top, margins [44, 0, 0, 0] (the toast).
  • volume-indicator with (bottom-right, 0, 40) sits at the bottom center with or without a top bar: anchor bottom, bottom margin 40, input none, no with_top_bar.
  • quick-settings gets the default glass (blur 12, radius 13.5) when its declaration has no glass. Since 2026-11-03 the core gives radius 16 and the same default to the other protected panels whose surface fills the window (openspec/specs/web-panels/spec.md, "Glass with real blur").
  • Any other value keeps its declared anchor and margins, with no with_top_bar, as today.

The top bar binds after the panels at startup: notifications has auto_open: true and opens in panelWindows.refresh() (desktop.cjs:215) before the /host-layout loop creates the top bar (desktop.cjs:224-250). with_top_bar keeps the toast at the top center once the top bar maps, with no new declaration.

Tests: a test in the core and one in the compositor compare the rectangles of the new solver with the old Panel::placement (which calls rectangle_with_client) for these four ids, and for isolated plugins of each anchor with and without offsets, on a table of outputs that includes outputs smaller than size plus offset, with and without each bar, and on a table of client sizes that includes (0, 0) (nothing committed yet). A compositor test maps notifications first, then binds a top bar, and checks that the toast moves to the top center; then it unmaps the top bar and checks that the toast goes back to its declared anchor. The Rust rules go away in phase 4.

The design: one opaque token in the title of a new toplevel, bound once to a declaration that only the host control connection can send.

  1. When AGENT_NATIVE_COMPOSITOR is "smithay", the Electron main process makes a 128-bit token with crypto.randomBytes(16) and asks the core to declare it before it creates a window: POST /host-window with {surface, panel?, output?, token} and the host main key (see Who may set what). The host keeps the token of a request across its retries, so a retry after a lost or timed-out answer is an in-place re-declare of the same token (The typed control commands), never a second token: a singleton role is never refused as "Only one window for this role" for the host's own lost answer, and no token leaks toward the limit of 64. In any other mode (npm run desktop, web-shell/package.json:13, or another compositor) the host never calls /host-window, sends no declaration and uses plain display titles. There is no Smithay control socket to declare on, and no title rule to feed.
  2. The core awaits webPanels.refresh() for a panel, builds the declaration from its fixed templates, or for a panel from its own validated registry by id, checks the token format, and sends window_declare {token, declaration} with the host's token on its control connection. The core applies the requests of one token (/host-window, /host-window-update, /host-window-forget) in arrival order, one at a time, so a forget that comes during a declare of the same token waits for it. The host sends a forget only after every request it made for that token settled (an answer or an error). It answers the host only after the compositor answers OK. The decisions of /host-window are in Core changes.
  3. The host creates the BrowserWindow with the title anos-window:<32 lowercase hex>. The token stays the title for the life of the BrowserWindow. Pages cannot change it (titleAllowed, and for the lock window hardenLockWindow, see Host changes), except the chat marker.
  4. The compositor binds a toplevel to the declaration when all of these hold:
    • the toplevel is a root (no parent),
    • its client is the registered host (host_window),
    • it has not committed a buffer yet,
    • its whole title equals a live token (exact compare, no prefix or parse),
    • no other live window is bound to that token. A window that only has the token as its title, and is not bound, does not count: a chat repair maps the new chat while the old unbound one still has the same title.
  5. The compositor checks at title_changed and at each commit before the first buffer, and binds as soon as the rules hold. The check runs first in both handlers, before anchor_canvas, the panel placement and the first-window focus (handlers/compositor.rs:50-99). A bound window stays bound for its life, whatever its title becomes later (the chat marker replaces the token after the bind). An unbound window that commits its first buffer stays undeclared for its life, even if a token title comes later; such a token title counts in windowDeclarations.lateBinds. The repair of an unbound window is a new toplevel (see Runtime repair below), never a late bind.
  6. When hide() and show() make a new toplevel, Chromium sends the stored title again, so the new toplevel binds to the same token. The host needs no round trip per show. This holds because the page cannot change the title. The one exception is the chat marker, and the chat is never hidden; if the host ever hides the chat, it sets the token title again before show().
  7. The host sends window_forget (through the core) when the BrowserWindow closes. The lock token is the one exception: the host declares it once (see Host changes), every lock BrowserWindow uses it in turn, and the host never forgets it on a close. LockWindows destroys the lock window at each dismiss and after each crash (web-shell/core/lock-window.cjs:39-59), and the rule "no other live window is bound to that token" lets the next lock window bind once the old one is gone. All tokens die when the host identity changes (the host exits, or another host registers), and the windows bound to them lose their declaration with the trust mark (sync_host_trust). The table holds at most 64 tokens. A forget must not get lost, or leaked tokens fill the table over a long session: the core answers /host-window-forget only after the compositor answered (OK, or "Unknown window token", which also counts as done). When the core has no control connection (it reconnects after any "Invalid request" or socket error, web-shell/core/smithay.js:1315-1341), the host keeps the token in a forget queue and retries every 500 ms until one of those answers comes. The host owns the queue, so a forget survives a reconnect of the core to the compositor. There is no restart of the core alone: the host spawns the core (desktop.cjs:162-187), and a core exit quits the host (child.on("exit"), desktop.cjs:278-280). The compositor then drops every token with the host identity (poll_host, session_lock.rs:441), so a core exit ends all host windows and their tokens together. A host test: a forget answered "connecting" is retried and applied after the reconnect, and windowDeclarations.tokens goes down.
  8. After the bind the compositor never reads the title for any rule. The snapshot reports title: name for a bound window. For an undeclared window of the host client whose whole title has the token form (anos-window: and 32 lowercase hex), the snapshot reports an empty title, so desktop_state and nested QA output do not repeat a token. This is a display rule of the snapshot only. It grants nothing.

Runtime repair: a host window that does not bind stays undeclared for its life (a late title, or a toplevel that fails another rule of step 4). A refused window_declare never gets a window: /host-window answers "refused" (Core changes). For the lock this is a lock screen with no unlock UI, because the lock scene draws only the window bound to role lock, and today LockWindows replaces a window only on render-process-gone or did-fail-load.

  • The source is the compositor command window_status {tokens} of phase 1b (The typed control commands): for each token it answers whether a mapped window is bound to it. The core never guesses this from the snapshot declaration objects, because during a kind flip or a chat repair two windows of one role or panel id live together, and several recovery windows can share one role.
  • (Phase 2 as built: lockBound, /host-window-status and the runtime repair below are not implemented.) Output chats (openspec/specs/multi-output-workspaces/spec.md, phase 2): output names the connector of an output chat, only for surface: "chat" and only on a compositor with capabilities.outputChats (else refused "Output chats are unavailable"). A token keeps its output. The host repairs an output chat that does not bind from the snapshot (wm.workspaceOutputs.outputs[].chat), not from /host-window-status. Output bars (openspec/changes/multi-output-workspaces/design.md, Decision of 2026-11-03): output also names the connector of the bottom bar of an extra output, only for surface: "bottom-bar" and only on a compositor with capabilities.outputBars (else refused "Output bars are unavailable"); the compositor keeps one bar per output, places it at the bottom strip of its output and reports outputs[].bar, and the host repairs it from wm.workspaceOutputs.outputs[].bar. GET /lock-state reports lockBound: window_status of the lock token. The main-key route POST /host-window-status sends window_status for the host's list of tokens and answers with its result.
  • LockWindows: when its window is shown and lockBound stays false for 2 s, it destroys the window and creates a new one with the same token. The token is free, because no live window is bound to it, and the new toplevel binds before its first buffer.
  • Panels: when a panel window is shown and /host-window-status reports its token unbound for 2 s, PanelWindows closes it, forgets the token and does not re-create it; it logs once, and the next file change or user open asks again. So an isolated plugin that fails to bind never stays on screen as an undeclared host window.
  • The host does the same for the chat, the bars and the wallpaper, with /host-window-status, at most three times per window and then once per minute, and logs each repair once.
  • Phases 2 and 3: a chat, a bar or the wallpaper that is not bound 2 s after it shows is replaced at once by a window with its legacy fixed title ("Agent Native OS", "Agent Native Desktop", "Agent Native Top Bar", "Agent Native Wallpaper"), which a phase 1b to 3 compositor classifies as today. Without this, the token title matches no legacy predicate, so the chat gets shell: false and the app band: applications cover the composer, and an agent window_action close passes the core check (desktop-client.js:483-491) and the compositor check (desktop.rs:1763) and quits the host. The host keeps asking for a tokened window in the background as the chat fallback does, and replaces the legacy window when one binds. A phase 2 test: an unbound chat is never shell: false for longer than the 2 s repair delay. (Phase 2 as built: this repair was never implemented, so phase 4 has no legacy-title repair window to remove.) From phase 4 the derived unbound band protects an unbound window instead. The chat repair keeps the conversation, because a reload of the chat preserves it (AGENTS.md). A chat repair creates the new chat first and destroys the old one after the new one loads, and it keeps the bars, the wallpaper and the open panels (see Host changes, chat replacement).
  • Phase 2 and phase 4 tests: an unbound lock window is re-created and binds; an unbound panel window is closed and its token forgotten; a refused panel declare creates no window; an unbound chat is re-created and binds, and the bars, the wallpaper and an open panel stay; a window that binds at once is never re-created.

Why this is safe:

  • Trust comes from the client identity at bind time (host_window), not from the text. A foreign client that sends the same title gets nothing.
  • The token is a correlation id, not a secret against processes of the user. Chromium exposes the window title as the AT-SPI frame name to any process on the session bus (web-shell/core/window-text.js:112-114 matches on those names), and a process of the user can trace the host. Safety comes only from the host_window check at bind time and from the host connection for window_declare. The snapshot, the logs and the agent tools still do not repeat the token, to keep it out of conversation content.
  • Only the host main process sets the title of a host window. Pages, plugins and generated HTML cannot change it (titleAllowed, the sandboxed iframes).
  • The declaration comes over the authenticated host connection only. The token only correlates the two channels, like a pairing code.

Accessibility: from phase 2 the AT-SPI frame name of each host window is the token text, and a screen reader can announce "anos-window:" and hex digits as the window name. The document node below the frame keeps the page title of each host page (web-shell/core/server.js:1659-1666, web-panels.cjs:443-447), so the page content keeps a readable name. Phase 2 checks the frame and document names with an AT-SPI dump in the nested run and records the result. A way to give the declared name to the frame (for example a Chromium accessible name override) is open; it must not change the Wayland title before the bind. Not verified with a screen reader.

Why this is race-free:

  • The compositor knows the token before the toplevel can exist: the host creates the window only after the core answered, and the core answers only after the compositor did.
  • set_title and the commits travel on the same Wayland connection, so they are ordered. Chromium sends the title when it creates the toplevel, before the first buffer. Nested run 7d27c66e showed quick settings at its declared place in the first state read after each show. Phase 1b adds lateBinds, and the nested QA of phases 2 to 4 requires it to stay 0.
  • Each window has its own token, so the creation order of concurrent windows does not matter.
  • The role is fixed before the first frame, so a window never draws in the wrong band, place or keyboard state and then moves.

Rejected options:

Option Why not
A per-window app id Electron 45 has none on Wayland. The app id is "electron" for every window.
An xdg-foreign handle from the host Electron exposes no export API. A native addon is a new privileged dependency.
The compositor reports each new host window, and the host matches by order Racy: startup creates five windows concurrently, hidden panels map in any order, DevTools and GTK dialogs are host-client toplevels too, and each show() makes a new toplevel. The window would map once with no role.
A size or min-size challenge Abuses geometry as data, and a client resize can collide with it.
One-time tokens re-armed before each show() Needs a round trip per show and a title change back to display text after each bind. The per-BrowserWindow token gives the same safety without that.
The fixed titles of today The user refused them ("é péssimo para evoluir o sistema"). Each new role needs a new title predicate in Rust.

If Electron later gives a per-window Wayland identity (an export handle or a per-window app id), only the link changes. The declaration model stays.

The paint marker

The chat page sets its title to Agent Native OS [workspace:N] after it renders a conversation (vendor/interface/host/workspace-zoom.js:289-314). The compositor reads it at each root buffer commit to tag which workspace painted the buffer (workspace_web.rs:39-52). The slide transition and the per-workspace GPU planes use that tag.

  • The marker is per-commit paint data. It is not an identity, a role, trust or a placement.
  • It must stay in band: set_title is ordered with wl_surface.commit on the same connection. A typed command over the core would arrive out of order with the commits, and the cache of the outgoing workspace would get pixels of the incoming one.
  • So the marker stays. In phase 4 the compositor reads it only on the window whose declaration has paints_workspaces: true (the chat), never to find the chat. The chat is found by its declaration.
  • The case of no marker yet: today web_content_matches (scene.rs:657-670) lets a chat with no painted workspace follow the logical plane only when its title is exactly "Agent Native OS". From phase 2 a bound chat has the token as its title until the page sets the marker, so that title check already fails in phase 2: between the bind and the first marker, and for a chat that never paints the marker (a core that cannot render a conversation), the web plane of the chat is composed for no workspace. Phase 1b replaces the title check with a role check: the window of role chat (a bound chat with paints_workspaces, or a legacy chat of legacy_declaration) with no painted workspace follows the logical plane (state.desktop.workspace == workspace). Phase 4 keeps this role check and deletes only the title comparison. A phase 1b test: a bound chat with a token title and no marker composes the plane of the active workspace, also during a slide before the first marker.

This is the one title read left after phase 4. See open question 2.

The chat dock

  • The chat declaration has placement: layout, and dock in a Canvas workspace.
  • In Canvas the compositor builds an anchored placement from the dock state (per workspace) and the dock side (one setting), and solves it with the same solver as the bars and panels:
    • expanded: area content, anchor left or right, margins 12, width fraction 0.3 held to 360..560, height fill (the content height minus both margins, as canvas::dock does, canvas.rs:440-462);
    • collapsed: area content, anchor bottom-left or bottom-right, margins 12, 640 x 180. Correction of 2026-11-02: 640 x 82, the composer only (openspec/specs/canvas-windows/spec.md, The floating chat).
  • Correction of 2026-11-02 (the centered chat that hides, openspec/specs/canvas-windows/spec.md, The floating chat): the two items above are history. The placement is one: area content, anchor center, margins 12, width fraction 0.4 held to 480..760, height fraction 0.75 held to 360..900, clamp size. The state collapsed hides the chat: visible_window draws it not and gives it no input, and it keeps the rectangle. The side moves nothing. The chat takes no camera exclusion: fit_viewport is the content area with the 12 px margin, and popup_area is the content area. canvas::dock_exclusion, Compositor::camera_exclusions and CameraEdge are removed. The item below is history.
  • (Phase 3 as built: the chat declares camera_exclusive: "dock", and the compositor takes the edge and the rectangle from the dock state.) camera_exclusive is the dock side when expanded and bottom when collapsed. fit_viewport (canvas.rs:204-219) and canvas::popup_area (canvas.rs:386-400, the area where the xdg positioner keeps a popup of a canvas window) subtract any window with camera_exclusive, not the chat by name. Today both take the dock state of the workspace (fit_viewport with its 12 px margin, popup_area with none, called from canvas_popup_target, canvas_mode.rs:1068-1086). A test checks that both give the same rectangles as before on the same table as the dock test.
  • canvas::dock stays as a thin function that returns this placement. A test checks that the solver gives the same rectangles as the old dock on a table of content areas and both states and sides.
  • The commands chat_dock, chat_dock_side and chat_glass stay as they are.

Who may set what

Actor Can Cannot
The Electron main process make a token and ask the core to declare it for its own built-in surfaces and for each panel of the registry, with the host main key send a declaration; choose properties (the core builds them)
The core send window_declare and window_forget on the host connection; build declarations from fixed templates and from validated web-panels.json entries declare from any other request; give a plugin a host band
The compositor bind tokens of the host client; refuse a band that the role does not allow read web-panels.json (after phase 4); read the title for a rule
A plugin (web-panels.json) choose layer desktop or hud, order, space, anchor, margins, size, input, keyboard, glass choose shell, raised, chrome, overlay or lock; drop confine: content; exclusive; camera_exclusive; keyboard exclusive
Any other process of the user nothing through declarations: the compositor refuses window_declare from a connection that is not the host connection
Generated HTML, trusted pages, agent tools nothing send or change a declaration, a title or a token

The host main key:

  • The host makes a second 32-byte key, the main key, and sends it to the core on file descriptor 3 with the launch key (openspec/specs/self-maintenance/spec.md, "The launch key does not reach the jobs").
  • /host-window, /host-window-update, /host-window-forget and /host-window-status accept only this key, in a header. The launch key is not enough, because the trusted renderers of the host send the launch cookie (desktop.cjs:199-206), so the launch key does not prove the main process. (The core prints the launch key in the browser session URL only when it makes its own key, printUrl: true in web-shell/core/launch-key.js:42-45 and server.js:89; with the key of the Electron host on file descriptor 3 it prints nothing.)
  • The main key never goes into a cookie, a URL, a log, a renderer or the environment.

Band rules, checked by the compositor for each window_declare:

Role Allowed layer Other rules
wallpaper background one per host; input none required
bar chrome one per edge (top or bottom)
chat shell one per host
recovery shell
panel, trust protected overlay
panel, trust isolated desktop or hud (phases 1b and 2: overlay, as today; from phase 3 a declaration in overlay is accepted and mapped to hud, see Version skew) area output with confine content, or a canvas rectangle
lock lock one per host; keyboard exclusive required

Role-only properties, refused with "Property not allowed for this role" on any other role, so the table holds against a core bug or a bad template (security rule 7):

Property Only for
keyboard: exclusive role lock
exclusive (a strip above 0) role bar
autohide, reserve (above 0) role bar with its anchor at the bottom edge
camera_exclusive role chat
paints_workspaces: true role chat
with_top_bar role panel, trust protected

Phase 1b has one refusal test per pair of this table and per required value (a wallpaper with input normal, a lock without keyboard exclusive).

The compositor does not know which panel ids are protected. The core decides that from the fixed list of the checkout (web-shell/core/web-panels.cjs:38-60), and only the host connection can send it.

Plugin fields in web-panels.json

New optional fields of each panel. The file stays version 1. Every new field has a default that gives today's placement, input and keyboard. The one change is the band: from phase 3 an isolated plugin with no layer is in hud, below the chat, where today it is above it (see The rule that keeps the protected surfaces above and unimitable).

Field Values Default Isolated Protected
layer desktop, hud hud allowed refused (always overlay)
order 0 to 15 0 allowed refused
space screen, canvas screen allowed refused (always screen)
anchor today's five, plus top, bottom, left, right (required, as today) allowed allowed
canvas_x, canvas_y -65536 to 65536 none required with space: canvas, refused otherwise refused
input normal, none normal allowed refused (the core sets it)

Rules:

  • A plugin adds its own HUD layer with layer and order. Plugins with the same layer and order share one layer, and focus raises them inside it.
  • space: "screen" (the default) keeps the plugin out of the camera. This is the property that the user asked for ("camadas que não participam do zoom").
  • space: "canvas" puts the plugin at (canvas_x, canvas_y) with width x height in canvas units, on every Canvas workspace, drawn through that camera, cropped to the content area. anchor must be top-left, and offsets and fit_content are refused. The plugin is hidden on a workspace that is not Canvas. Input uses the inverse transform and the input threshold, as for canvas windows.
  • width, height, offset_x, offset_y, keyboard, fit_content and glass keep their meaning. The core maps the offsets to the margins of the anchored edges, measured from the output edge, with confine: content (see Placement). A core test and a compositor test compare isolated plugins of each anchor with Panel::placement on outputs with and without each bar.
  • An isolated plugin is always solved on area output with confine: content, so its offsets keep today's meaning (measured from the output edge) and it never covers the bars.

Validation on both sides:

  • One parser module, web-panels.cjs, serves both Node processes: the core instance and the host instance (desktop.cjs:28-29). After phase 4 it is the only parser of the file; the compositor no longer reads it. It checks types, ranges and the table above, and it refuses the whole file on any error and keeps the last valid set, as today. GET /api/web-panels reports the error.
  • From phase 2 the core instance drives the declarations, and the host takes the panel properties that it needs (window size, focusable, keyboard, the protected toggle, auto_open, close_on_blur, fit_content) from the /host-window answer, which carries the spec that the core declared. The host instance only discovers which ids exist and when the file changes. So the window and its declaration never use two different parses.
  • /host-window and each re-declare await webPanels.refresh() in the core first, so a new plugin id does not wait for the 30 s bar poll and a re-declare is never built from a stale core registry.
  • (Phase 2 as built replaces this route with /host-window and the live token.) A re-declare starts only from the host, through the main-key route POST /host-window-update {token}. The host registry only notices that the file changed for the id of a live panel token; it then sends this request and does not apply its own parse. The core awaits webPanels.refresh(), builds the declaration of that id from its registry, sends window_declare with the same token, and answers with the spec that it declared. The host applies the window size, focusable, keyboard and the fit only from that answer, so the window and its declaration use one parse. Today the host resizes the window and changes focusable from its own parse at each refresh (panel-windows.cjs:195-211); phase 2 removes that path. The answers: {decision: "declare", spec} (applied), {decision: "replace"} (the kind changed, so the trust changed: the host closes the window, forgets the token and opens a new window with a new token), {decision: "unknown"} (the id is gone: the host closes the window and forgets the token), {decision: "locked"} and {decision: "connecting"} (the host retries every 500 ms and keeps the old spec until then).
  • (Phase 2 as built: no re-declare of every panel at the unlock; a "locked" re-declare retries every 500 ms.) A re-declare refused with "Session is locked" is not lost: the host retries it, and at the unlock the core also sends the declarations of all live panel tokens again.
  • The compositor checks the typed window_declare that it gets: the role and band table, the ranges of every number, the anchor and space rules, the singleton roles and the token format. It parses the raw declaration with deny_unknown_fields inside control_command, so a schema error is the typed refusal "Invalid window declaration" with the request id and never the id 0 "Invalid request" that drops the connection (The typed control commands). A refusal leaves the token unbound, the window stays an ordinary undeclared window, and the runtime repair of The window link applies.
  • Until phase 4 the compositor still reads the file for windows that have no declaration (the fallback). From phase 1b it uses the declaration of a bound panel and ignores its entry in the file (see Phase 1b). Phase 3 extends the web_panels.rs parser with the new plugin fields (layer, order, space, canvas_x, canvas_y, input and the new anchors), so a file that uses them does not set panel_error. Without that, reload_web_panels (desktop.rs:675-708) keeps self.desktop.panels, so the fallback freezes at the last valid parse, and after a compositor restart, with no earlier parse, it has no fallback specs. The fallback ignores layer, order, space and input and places such a panel as today.

The rule that keeps the protected surfaces above and unimitable

  • The composer and the approval dialogs live in the chat window. The chat is in the shell band. Plugins are in the desktop or hud band, applications in app or floating, and from phase 4 a host window that did not bind is in unbound. So no plugin, no application and no unbound host window draws above the chat or takes its input. This changes today's rule (every panel above the chat) for isolated plugins only.
  • Above the shell band are only raised (derived by the compositor), chrome (the bars), overlay (the protected panels, fixed checkout assets) and lock. Only the host connection can declare them, and the core declares them only for its own built-in surfaces.
  • The lock has its own scene. Only the lock is drawn, and only the lock gets input and the keyboard (openspec/specs/lock-screen/spec.md). The lock role adds nothing to that.
  • The recovery window moves to the shell band (see Declarations of the host windows).
  • Imitation: an application or a plugin can draw pixels that look like the composer inside its own window. It cannot draw them above the real composer or take pointer input on top of it.
  • The keyboard: a plugin with keyboard: true (on_show) takes the keyboard at each show, because each show is a new toplevel (desktop/layout.rs:271-281). Below the chat it could then hold the keyboard while the user sees the composer. So phase 3 adds a compositor rule for the focus that the user did not point at: an on_show focus, or a focus by command, goes to a desktop or hud window only when no visible window of a higher band intersects its rectangle; otherwise the keyboard stays where it is. A click is different: it already reaches the topmost surface at the pointer (hit_in), so a click that hits an on_demand plugin gives it the keyboard, also when a higher band covers another part of it. A test maps the chat over a keyboard plugin and checks that the show leaves the keyboard on the chat; a second test checks that the plugin takes the keyboard at its show when nothing covers it; a third test clicks the uncovered part of a partly covered plugin and checks that it takes the keyboard. This rule does not know about approvals. The guard of a pending approval stays in the chat: the 1.5 s arming, the focus on "Recusar", and the disarm on blur (openspec/specs/self-maintenance/spec.md). The isolated iframe of a plugin has sandbox="allow-scripts", CSP connect-src 'none' and no subframe navigation (web-panels.cjs:473-478, desktop.cjs:136-147), so a plugin that gets keystrokes cannot send them out.

Why plugins go below the chat and not above it with an input cut-out: the compositor knows no DOM rectangles of the composer or the dialogs. A cut-out would need the host to report them, and a plugin could still cover a region during the report delay. Below the chat needs no geometry. The cost: where the chat covers the content area (Floating, the Chat presentation), a plugin under it is not reachable. The live configuration has no isolated plugin, so nothing visible changes.

The typed control commands and their refusals

{"action": "window_declare", "token": "<32 lowercase hex>", "declaration": {...}}
{"action": "window_forget", "token": "<32 lowercase hex>"}
{"action": "window_status", "tokens": ["<32 lowercase hex>", ...]}
  • The control envelope keeps deny_unknown_fields, but Command::WindowDeclare carries declaration as a raw serde_json::Value. Today respond (ipc.rs:262-267) deserializes the whole Request first, and any serde error answers id 0 "Invalid request"; the core has no pending id 0, throws "Unexpected Smithay response" and reconnects (web-shell/core/smithay.js:1035-1036, 1315-1341), and it loses the lock authority and every pending command. So control_command parses the declaration itself into the typed struct (with deny_unknown_fields), checks every range, and answers any schema or range error with the request id and the typed error "Invalid window declaration". An unknown field, an unknown enum value or a range error in a declaration never drops the connection. A phase 1b test: a declaration with an unknown field and one with an unknown layer each get "Invalid window declaration" with the request id, and the next command on the same connection succeeds.

  • window_status answers the usual reply with the state, plus a top-level windowStatus object that maps each asked token to true (a mapped window is bound to it) or false (no window, an unmapped window, or not a live token). At most 64 tokens per request. The tokens never go into the state snapshot. A phase 1b test: a token is false before its window maps, true after its first buffer, false after the window is destroyed, and false for a foreign window with that title.

  • window_declare with a new token adds it. With a live token it replaces the declaration in place: a bound window takes the new placement, order and glass at once. The role, the panel id and the panel trust of a token cannot change, so a live window never moves between the hud and overlay bands.

  • The three commands are accepted only on SessionLock::host_connection() (session_lock.rs:450), as control_command does for unlock and lock_host.

Refusal When
"Window declarations need the host connection" no host is registered, or the connection is not the host connection
"Session is locked" window_declare while locked, except for role lock (so a host that starts behind the lock can declare its lock window); window_forget is allowed while locked
"Invalid window token" not 32 lowercase hex characters
"Too many window declarations" 64 live tokens
"Layer not allowed for this role" the band table
"Invalid window placement" a range, an anchor or a space rule
"Only one window for this role" a second chat, wallpaper, lock or bar of the same edge
"A declaration keeps its role" an update that changes the role, the panel id or the panel trust
"Unknown window token" window_forget of a token that is not live
"Too many window tokens" window_status with more than 64 tokens
"Invalid window declaration" the declaration does not parse: an unknown field, an unknown enum value, a wrong type or a range that the typed struct checks
"Property not allowed for this role" a role-only property on another role (the band rules table)
"Invalid window declaration" (range) reserve or exclusive above 256, an autohide value other than intellihide

From phase 4 the shell lock (lock_session) has one more refusal: "No lock window is declared", while the registered host has no live token of role lock (see Version skew).

The app dock bar

A bottom bar with autohide: "intellihide" is the app dock of its output (the primary bar, or the bottom bar of an extra output). Phase 1 of the change dock-theme adds the compositor side, and no theme declares it yet, so the product looks the same.

  • Strips. layers::bar_height returns the exclusive of a bar with autohide as it is (0 for the app dock), and every caller reads that value: the content area, the primary layout, the plain workspaces, the overview grid, the Canvas fit viewport and popup area, the bar of an extra output and its content area. A bar without autohide keeps today's values. The app dock window is placed from its declared placement at the bottom edge of its output, over the content area.
  • Readers of reserve. The box of the chat sits at the bottom center above it, the whole chat (the column, or the centered chat) ends above it, a protected panel anchored at the bottom keeps its margin above it, and the Grid cells end above it. A zoomed Grid window, a maximized window, a floating window and a Canvas window ignore it.
  • Decision per output (design.md D5 of the change). At the end of each layout pass and at each control tick, touched is true when an application window (bands app and floating, not a shell window, not minimized, on the visible workspace of that output, in Grid and in Canvas) is drawn with a rectangle that intersects the region of the dock. The dock hides after 150 ms of continuous touched and shows at once otherwise. Holds keep it shown: the pointer inside the region, a reason of the host (popup, chat, drag), a reveal until the pointer leaves, and the overview open on that output. A workspace transition, a camera flight and the lock freeze the state, and the state is computed again at their end. Before the first region the whole bar window is the region.
  • Reveal. While hidden, the dock window takes input only on the last pixel row of its output across the region. The pointer resting there for 250 ms reveals it, and a revealed dock, or one that the pointer was over or that a hold kept, hides 400 ms after the pointer leaves the region or the hold ends if a window still touches it. The pointer resting on the reveal row counts as inside while the dock is revealed. A fullscreen window on the output and the lock disable that row. A hot corner at a bottom corner keeps working, because the row spans only the region.
  • Input clip. Every hit test of the dock window is clipped to the region while it shows and to the row while it is hidden, whatever the page paints: pointer focus (and so enter, leave and the cursor shape), touch, the data device focus of a drag, the popup parent lookup, a press and the root under a point. Outside the clip the hit test goes on to the window below. This is a compositor clip against the declared region, not a wl_surface.set_input_region.
  • Commands, on the registered host connection only, with "The app dock needs the host connection" for any other: app_dock_region {output, x, y, width, height} (logical pixels of the dock bar window of that output, clamped to that window, refused with "Invalid app dock region" when nothing is left, at most 4 accepted per second per output with "Too many app dock regions" for the next one, and the latest accepted region stays in force) and app_dock_hold {output, reasons} (the closed list popup, chat, drag, "Unknown app dock hold reason" for any other; drag keeps the dock shown while files are dragged over it). Both are refused with "Session is locked" while locked and with "The output has no app dock" when that output has no dock bar. The holds end with the connection that sent them. The core routes are POST /api/app-dock-region and POST /api/app-dock-hold, which take the shell token like every /api route, clamp the region to the dock bar window of the state, refuse during a lock and send only with the capability. No agent tool, MCP entry, generated HTML or plugin panel has a route or command for them.
  • Snapshot. appDock: [{output, hidden, revealed}], one entry per output that has a dock bar mapped, and capabilities.appDockAutohide: true. The core passes the entries to the bar view (wm.appDock) only with the capability.

Snapshot fields and capability

  • capabilities.windowDeclarations: true (phase 1b). The core sends nothing new without it.
  • capabilities.hudPlugins: true (phase 3): the compositor accepts the desktop and hud bands, canvas-space panels and the new anchors. (Phase 3 as built: it refuses an isolated panel declared in overlay with "Layer not allowed for this role" instead of a map to hud; see Phase 3 as built.) Without it, the core declares isolated panels in overlay (today's place) and refuses a web-panels.json that uses the new plugin fields, with the error in GET /api/web-panels.
  • capabilities.declarationsRequired: true (phase 4): the compositor reads no title rule and gives an undeclared host window no role. An older host cannot read this, so the guard is in the persistent plan of a host and core maintenance restart (Version skew).
  • The declared names in phase 2 are today's titles ("Agent Native OS", "Agent Native Desktop", "Agent Native Top Bar", "Agent Native Wallpaper", "Agent Native Panel:<id>", "Recuperar alterações"), so a tool that prints titles shows the same text. After phase 4 nothing matches on them.
  • Per window, declaration: null for every window that is not bound (phases 1b to 3: legacy windows of legacy_declaration included, so a consumer never mistakes a legacy chat for a bound one; since phase 4 legacy_declaration is gone and an unbound host window is null too), or for a bound window {role, layer, order, space, input, keyboard, edge, panel} (edge is top or bottom for role bar and null otherwise; panel is {id, trust} or null). The token is never reported. The compositor derives edge from the anchor of the bar placement, so a consumer tells the two bars apart with no title and no y coordinate.
  • Per window, title: the declared name for a bound window, the client title otherwise (empty for an unbound host window with a token title, see The window link, step 8).
  • Top level, windowDeclarations: {tokens, bound, lateBinds}. These are counts; the bind state of one token comes only from window_status.
  • sessionLock.panelReady (session_lock.rs:556-563, 881-884) is today lock_panel_window().is_some(), a consumer of the lock title rule, and it means "exists", not "mapped". From phase 1b it means that a mapped window of role lock exists (a bound lock window, or until phase 4 a legacy lock window of legacy_declaration). sessionLock has an exact key set (web-shell/core/smithay.js:431-436), so no key is added. No core code reads panelReady apart from that check.
  • shell stays in the per-window state permanently. validState requires a boolean shell on every window (web-shell/core/smithay.js:286-294), so a core without it throws "Invalid Smithay window" on every state and loses window control after a host and core rollback.
  • Phases 1b to 3: shell (the snapshot field and the internal WindowMeta::shell) is today's legacy shell predicate or a declaration. A bound window is shell: true; every other window keeps today's value. So nothing that the user sees changes in phase 1b, apart from the first-window focus rule of Phase 1b. In phase 2 the recovery window becomes declared and so shell: true; the phase 2 effects below list what that changes.
  • Phase 4: one predicate, a host-owned window, is a window of the registered host client (host_window, on any of its connections) or a declared window. Every declared window is a host window, so this is host_window in practice; the second term only states the rule. The snapshot shell, WindowMeta::shell and every compositor gate use it. The key no longer depends on a title. Trust then comes from the client identity, as the decision says, and not from a successful bind.
  • Phase 4, an undeclared host-owned root (a late bind, an unbound panel window (as built, the host does not close it; see Phase 4 as built), the fallback chat of Host changes, a chat of an older host, a DevTools window): the compositor gives it the derived band unbound, order 0, never app and never shell. That band is between hud and shell: above applications and plugins, below the chat, so a host window that failed to bind (an isolated plugin, a DevTools window) never draws above the composer or the approvals, or takes their input. It is global, not tiled and not on the canvas, and it is placed centered in the content area at its client size up to 1280x900, as the recovery declaration. Its role-free gates are those of a declared window: close, minimize, bind, maximize, move, resize, pair, send_to_output, canvas_move, the grid commands of grid_window (place, toggle_floating, fill_grid and Super+Shift+Space) and the grabs refuse it, target() treats it as global, effect_target leaves it out, and no desktop, hud, app or floating window draws above it. A GTK message box is a dialog of its declared parent (Dialogs) and takes the parent's band. So on a phase 4 compositor, after lock_host registered the host, the fallback chat stays protected against an agent window_action and against a cover by an application or a plugin, while it has no declaration. Before lock_host, no host window is trusted on any compositor, so the fallback chat is an ordinary window; on a compositor without the capability the legacy title "Agent Native OS" gives it today's shell protection (Host changes, the chat fallback).
  • Visible effects of shell: true on a window that was shell: false (the recovery window in phase 2, a DevTools window in phase 4): the bar workspace tabs and the conversation app lists drop it (vendor/interface/host/host.js:600, 976); the manual control and window reading lists drop it (host.js:2562, 2640); gridTargetRefusal refuses it (grid.js:47), which matches the compositor because it is no longer tiled; workspace-navigation.js:268 no longer counts it as a visible application; the capture candidates and focusedApplication leave it out (window-capture.js:67, smithay.js:1086). Each effect gets a test in the phase that makes it.
  • A grep test in the core (phase 2) lists every reader of .shell on a window in web-shell/core, vendor/interface/host and scripts/nested-qa.py, with the gate it serves, and fails on a new reader that is not listed.
  • The per-window object of the core has no exact key set (web-shell/core/smithay.js validState), so an older core accepts the new fields. No new key goes into the objects with an exact key set (canvasWorkspaces entries, sessionLock, overviewPlanes, the glass objects).

Core changes

  • web-shell/core/launch-key.js: read the main key from the same descriptor.
  • New web-shell/core/window-declarations.js: the templates of the host surfaces, the panel mapping (with the protected defaults), the token format check, the per-token order of requests, and the main-key routes POST /host-window, POST /host-window-update, POST /host-window-forget and POST /host-window-status in server.js.
  • /host-window answers one of these decisions, so the host can tell the cases apart:
Decision When What the host does
{decision: "declare", spec?} the compositor answered OK; spec is the panel spec that the core declared creates the window with its token as the title
{decision: "legacy"} phases 2 and 3 only, gone since phase 4: the compositor is connected and has no windowDeclarations capability created the window with the fixed title
{decision: "unsupported"} phase 4 (as built: {decision: "wait", reason: "unsupported"}): the compositor is connected and has no capability see the chat fallback below; LockWindows creates its window with the legacy lock title (see Version skew); other surfaces are not created
{decision: "connecting"} no compositor connection yet, or no lock_host registered yet retries every 500 ms; the chat fallback below applies
{decision: "locked"} the session is locked and the role is not lock retries every 500 ms; no fallback (the lock scene draws nothing else)
{decision: "unknown"} a panel id that the core registry does not have after its refresh does not create the panel window; the next file change of the host registry asks again
{decision: "refused", error} the compositor refused window_declare (a refusal of the command table, for example a validator mismatch on a field of web-panels.json or "Too many window declarations") for a panel: creates no window and logs the error once; the next file change asks again. For the chat: the chat fallback below. For the bars, the wallpaper and recovery: creates no window and logs once. The lock: LockWindows retries every 2 s and logs once
  • The core sends lock_host as soon as it connects, so "connecting" at startup is short.
  • web-shell/core/smithay.js: declareWindow and forgetWindow, gated on the capability. At the unlock it sends the declarations of the live panel tokens again.
  • web-shell/core/web-panels.cjs: the new fields, their validation and the protected defaults.
  • Consumers read declaration, not the title: chatWindow and the bar guard of /api/wm (desktop-client.js:185-198, 483-491), the wallpaper of window-capture.js:99, desktop_state (declared windows show by name and role, never by token), and scripts/nested-qa.py (BAR_TITLE becomes the role bar with declaration.edge top).
  • Every other reader of window.shell keeps reading shell, which stays in the snapshot with the meaning of Snapshot fields (the host-owned predicate from phase 4). Phase 2 lists them in the grep test, each with one test of its gate that uses a window with shell: true and no title rule: window-text.js:58, 68, 226 (read_window_text refuses host windows); memory-policy.js:133 (no close proposal for host windows); desktop-client.js:89, 105, 151, 486, 494, 559 (hold, held windows, send_to_output); grid.js:47; desktop.js:156, 246, 470, 519; manual-control.js:104; workspaces.js:63; workspace-navigation.js:268; window-session.js:157, 243, 251, 361; window-capture.js:67; smithay.js:1086, 1095; vendor/interface/host/host.js:600, 976, 2562 (manual control list), 2640 (window reading list).

Host changes

  • Only when AGENT_NATIVE_COMPOSITOR is "smithay". In any other mode (npm run desktop, desktop.cjs:75, 95, 211, 224) createWindow stays synchronous, uses plain display titles and never calls /host-window. A Node test covers this branch: with the variable unset, the host makes no /host-window request and the chat opens at once.
  • web-shell/desktop.cjs: in Smithay mode a host surface opens through an async request. It asks /host-window first and uses the token as the title. It retries "connecting" and "locked" every 500 ms, as the top bar does today (desktop.cjs:229-250). On "legacy" it uses today's fixed title (phases 2 and 3 only).
  • The chat fallback, in every phase: when the chat has no "declare" or "legacy" answer after 10 s and the last answer is "connecting" or "unsupported" (or the core does not answer), the host creates the chat as a plain window, so the user can still talk to the agent, repair a disconnected compositor and reach recovery. In every phase the fallback uses the fixed title "Agent Native OS", because the host cannot tell from "connecting" which compositor runs, and on "unsupported" the compositor reads titles. A compositor without the capability (phases 1a to 3, or older) classifies that title as today: a shell window. A phase 4 compositor reads no rule from it: the fallback chat is an undeclared host-owned root in the derived unbound band, with shell: true and the compositor gates of Snapshot fields. On any compositor these protections start only after the core registered the host with lock_host: before that host_window is false (session_lock.rs:592-610), so every host window, the fallback chat included, is an ordinary window. The core sends lock_host as soon as it connects, so this gap is short. After phase 4 this is the second compatibility title of the host (see Version skew); no phase 4 compositor rule reads it. Only after a fallback on "connecting", the host keeps asking /host-window in the background; on "declare" it creates a tokened chat and destroys the fallback chat after the new one loads the route of the fallback chat (Phase 4 as built). After a fallback on "unsupported" or on a refusal the fallback chat stays for the life of the host. The conversation stays, because a reload of the chat preserves it. On "locked" there is no fallback: the lock scene draws only the lock.
  • Chat replacement: today the closed event of the chat BrowserWindow closes every web panel and the wallpaper (desktop.cjs:220-223) and both bars (desktop.cjs:251-254), and the /host-layout loop that creates the top bar stops once chat.isDestroyed() (desktop.cjs:228). The chat repair and the replacement of the fallback chat destroy a chat while the host keeps running, so these handlers would tear down the desktop. Phase 2 binds the teardown to the host shutdown (before-quit, which sets stopping, desktop.cjs:383-389), not to the closed event of one chat BrowserWindow, and the top bar loop runs while !stopping. A close of the current chat that is not a replacement calls app.quit(), so the bars, the wallpaper and the panels still end with the chat, as today. A replacement creates the new chat first, moves the chat reference to it after it loads, and then destroys the old one. A host test: a chat repair and a fallback replacement each keep both bars, the wallpaper and an open panel, and a top bar that was still pending is created.
  • Startup order: the host starts LockWindows first, apart from the other surfaces and without awaiting them. LockWindows requests the lock token and starts its poller at once; the wallpaper, the chat, the bars and the panels open concurrently after it. Today lockWindows.start() runs after the wallpaper, the chat and the bottom bar in one sequence (desktop.cjs:211-268); the top bar comes later from the un-awaited /host-layout loop (desktop.cjs:226-250); an async startup that awaited the chat first would leave a host that starts behind the lock with no lock window and no way to unlock.
  • titleAllowed (host-navigation.cjs) allows only the token, and for the chat also the marker.
  • web-shell/core/panel-windows.cjs: one token per panel BrowserWindow; a file change for a live panel goes through /host-window-update (Validation on both sides), which re-declares with the same token, and PanelWindows takes size, focusable and fit only from its answer; window_forget on closed, with the forget queue of The window link, step 7. A change of kind (isolated to protected or back) is a change of trust: on the answer "replace", PanelWindows closes the BrowserWindow and forgets its token, then opens a new window with a new token, never a reload() (today a changed revision reloads the same window, panel-windows.cjs:208-211). A compositor test: a re-declare that changes the trust is refused. A host test: a kind flip gives a new window and a new token. open() makes the entry at once in a pending state, before the token round trip. A second open() or a toggle of a pending entry cancels the open: when the answer comes, the window is not created and the token is forgotten. So the toggle logic still finds the entry at once, and a double open never makes two windows.
  • web-shell/core/lock-window.cjs, the lock title: hardenLockWindow (lock-window.cjs:144-148) has its own title check and does not use titleAllowed. Today it lets a page title through when it equals the fixed lock title, and the lock page sets exactly that title (vendor/interface/host/lock-screen.html:6). The lock window is created hidden and shown only on ready-to-show (lock-window.cjs:163), and on Wayland the xdg_toplevel exists only from that show. So with today's check the page load renames the hidden tokened window to the legacy title, the toplevel maps with that title, and it never binds. Phase 2 passes the window title to hardenLockWindow, as createWindow passes windowTitle to titleAllowed, and the check lets a page title through only when it equals that title (the lock token, or the legacy lock title on "unsupported"). A host test: a lock window created with a token keeps the token title after the lock page loads.
  • web-shell/core/lock-window.cjs: LockWindows makes the lock token once at start and asks /host-window to declare it (retrying on "connecting" with the same token; "Session is locked" never refuses role lock), and each lock window uses that token. The lock token is never forgotten on a close (The window link, step 7). The runtime repair re-creates an unbound lock window.
  • The recovery window gets a token in setWindowOpenHandler (desktop.cjs:146).
  • A host test of the lost answer: the compositor accepts a /host-window declare and the answer is lost (the request times out); the retry with the same token is an in-place re-declare, the result is one live token (windowDeclarations.tokens up by one) and a bound window, also for the lock and the chat.
  • DevTools windows and Electron message boxes get no token. A DevTools window is an undeclared window in the app band until phase 4, and from phase 4 an undeclared host-owned root in the derived unbound band (Snapshot fields). A GTK message box is a dialog of its declared parent by the host dialog rule (How the parts use the model, Dialogs).

Version skew

  • The core and the host always come from the same checkout (desktop.cjs:165-168), so they never skew. The compositor can skew both ways: a host and core maintenance restart runs a new host on an older compositor, and a rollback runs an older host on a newer compositor.
  • New host and core, older compositor (phases 2 and 3): no capability, so /host-window answers "legacy" and the host uses the fixed titles. The older compositor reads the titles and the file as today. A file that uses the new plugin fields makes an older compositor keep its last valid parse, as for fit_content today; the core reports this in GET /api/web-panels.
  • Host and core from before phase 2, newer compositor (phases 1 to 3): nothing declares, and the title fallback of the compositor (with the Rust per-id rules, kept until phase 4) gives today's behavior.
  • Phase 2 host and core, phase 1b compositor (the normal case: a host and core maintenance restart deploys phase 2 into a session whose compositor changes only at the next login): the compositor reports windowDeclarations, the core answers "declare", and the 1b compositor places, shows and keys every bound window from its declaration (Phase 1b). Phase 1b owns the fixture (native/smithay/testdata/host-declarations.json, the declarations that the phase 2 core will build for every host surface and the four protected panels) and the compositor test that declares them and checks that quick settings, the toast and the volume indicator show at their old rectangles. Phase 2 adds the core test that checks its templates against the same fixture file, so the two sides cannot drift.
  • (Phase 3 as built: the phase 3 compositor refuses the overlay declaration, so the plugin gets no window on this pair and never draws above the chat; the rest of this item is the original text.) Phase 2 host and core, phase 3 compositor (for example after a host and core rollback): the host declares isolated panels in overlay. The phase 3 compositor accepts that declaration and maps it to hud, so the plugin binds and keeps a role; it draws below the chat, as phase 3 intends. The phase 3 web_panels.rs parser accepts the new plugin fields, so the fallback specs stay valid. A phase 3 test declares an isolated panel in overlay and checks that it binds in hud.
  • Phase 4 removes both fallbacks. After phase 4:
    • a phase 4 host on a compositor without the capability gets "unsupported" for every surface. It creates the chat and recovery, as plain windows after 10 s (the chat fallback of Host changes, and Phase 4 as built), so the user can still talk to the agent and reach recovery; it logs the skew once. The older compositor still accepts a shell lock (Super+L, the control lock, session_lock.rs:823-829) once lock_host is registered, and its lock scene draws only a window titled "Agent Native Panel:lock-screen" (session_lock.rs:612-621). So, on "unsupported" only, LockWindows creates its window with that legacy title. This and the fallback chat title "Agent Native OS" (Host changes) are the two fixed titles left in the host after phase 4. It is compatibility text for a compositor that reads titles; a phase 4 compositor never answers "unsupported", so it never sees it, and no phase 4 compositor rule reads it. Without it the user gets a lock screen with no unlock UI. A host test: on "unsupported", LockWindows uses the legacy lock title, and on "declare" the token;
    • a phase 4 compositor refuses every shell lock request (Super+L and the control lock, lock_session, session_lock.rs:823-829) with "No lock window is declared" while the registered host has no live token of role lock, and the session stays unlocked with its windows. An older host declares nothing, so its core reports that lock is unavailable instead of a lock screen with no unlock UI. A lock that an ext-session-lock client owns is not affected. A compositor test: a shell lock with no declared lock token is refused and the session stays unlocked; with a declared lock token it locks;
    • a phase 4 compositor gives a host from before phase 2 (a host that does not declare) no roles: its windows are undeclared host-owned roots in the derived unbound band, with shell: true and the compositor gates of Snapshot fields. What the user sees: every window of that host, the wallpaper (an opaque page with input normal), both bars, the panels and the chat, draws centered in the content area at up to 1280x900, in the unbound band above every application and every plugin. The wallpaper and the bars cover the applications, and the chat may be under the wallpaper, so the desktop is not usable until a new login with a known-good pair.
    • So a rollback across phase 4 rolls back the compositor and the host together, through a new login or the known-good fallback. Phase 4 ships only after phases 2 and 3 have run for one login in the live session.
    • Phase 2 or phase 3 host and core, phase 4 compositor (a host and core rollback that stays after phase 2): the host sees windowDeclarations, gets "declare" and binds every surface, and the phase 4 compositor maps an isolated panel declared in overlay to hud, as phase 3 does (Phase 3 as built: the compositor refuses that overlay declaration, so a phase 2 host gets no isolated plugin window on this pair). This pair works. Its differences from a phase 4 host: the fallback chat (the runtime repair was never implemented) is an undeclared host-owned root in the unbound band instead of a shell window and never binds, and so are a recovery fallback and the DevTools windows of that host (scripts/check-host-skew.py warns about both, review round 2), and a phase 2 host has none of the plugin fields of phase 3. A phase 4 test declares the fixture of the phase 2 core declarations (Phase 1b) and checks the same rectangles and bands.
    • The other direction: a host and core maintenance rollback that puts a host from before phase 2 on a running phase 4 compositor gives the screen above. So the persistent plan of every host and core maintenance restart reads the live compositor capabilities in a read-only state query and refuses to deploy a host and core from before phase 2 (a checkout without web-shell/core/window-declarations.js) when the compositor reports capabilities.declarationsRequired. A rollback to a phase 2 or phase 3 host and core is allowed. A rollback before phase 2 goes through a new login with the known-good compositor and host pair.
    • A host and core maintenance restart (AGENTS.md, Host/core maintenance) deploys a phase 4 host and core into a running session only when the live compositor reports capabilities.windowDeclarations in a read-only state query. The persistent plan of that restart records the check. The legacy lock title above is the guard for the case that this check misses.

How the parts use the model

Part Today With declarations
Stack order stacking_key from titles (band, order) from the declaration; derived bands for undeclared, floating, Palette and thumbnail motion
Canvas camera canvas_rect is None for meta.shell canvas_rect is None for every declared window, so it stays the accessor of canvas applications only; a canvas-space plugin has its own accessor plugin_canvas_rect, which canvas_placement and canvas_clip also take, so draw, crop, hit and popups follow (see Canvas-space plugins and the canvas code); place_canvas takes only undeclared root windows
Camera fit and popup area fit_viewport and canvas::popup_area subtract the dock subtract each camera_exclusive window
Chat dock canvas::dock special case an anchored placement of the chat declaration, same solver
Dialogs parent_window uses meta.shell; a shell child may be on another connection of the host uses declaration.is_some(); a declared window is always a root. An undeclared child of a declared parent is a dialog when it is on the same client connection, or when it is a window of the host client (host_window, any of its connections) that links to the declared parent through xdg-foreign: the GTK message box of a host window. It takes the band and order of its root. Any other child of a declared parent is refused as a dialog. Phase 4 reworks a_dialog_of_the_shell_on_its_own_connection_centers_on_the_chat (session_lock_tests.rs:2543) to this rule, with no app id: the box on a second host connection centers on the declared chat and draws in the shell band, and the same box from a foreign client is no dialog of the chat
Focus keyboard_target by role predicates by the keyboard property; give_focus keeps per-workspace focus only for undeclared windows; raise stays inside the band
Hit testing hit_in leaves out passive leaves out input: none; same topmost rule
Overview and Workspaces wallpaper full, bars and panels fixed, chat as UI background band full; chrome and overlay fixed; desktop and hud hidden in Workspaces and fixed in the window overview, as panels today; the chat by role
Transitions bars fixed, chat and panels slide chrome fixed; chat and role panel slide; background is the background card
Workspace scope meta.shell is global every declared window is global; from phase 4 every host-owned window
Lock lock window by title and host_window the window bound to the role lock; from phase 4 a shell lock is refused while no lock token is live (Version skew)
Secondary outputs host_window or shell_named at open host_window only; send_to_output refuses declared windows; extra outputs show no declared window except the wallpaper copy
Palette the chat in Palette gets key 4 the role chat in Palette gets the derived raised band
Layout exclusive strips desktop_strips with fixed 32 and 40 the exclusive of the bound bars; the same 32 and 40
Glass keyed by bar, chat and panel spec; only the bottom bar takes bar_glass (scene.rs:59-66, 263-268) bar_glass applies only to role bar with edge: bottom, chat_glass to role chat, and a panel takes the glass of its declaration. The top bar gets no bar glass, as today. A phase 1a test: the top bar gets no bar glass, in the visible glass set and in glass_request
Commands and grabs refuse shell, passive, chrome; grid_window refuses a shell window or root; target() exempts shell from the workspace check refuse declared windows, and from phase 4 every host-owned window (close, minimize, bind, maximize, move, resize, pair, send_to_output, canvas_move, and through grid_window (desktop/tiling.rs:594-602) place, toggle_floating, fill_grid and Super+Shift+Space); target() (desktop.rs:1260-1269) exempts the same windows from the inactive-workspace check; target_any_workspace refuses role wallpaper. The core window_action does not check shell for minimize, expand, place, toggle_floating or fill_grid (web-shell/core/desktop.js:478-488), so these compositor gates are the protection
Effects effect_target leaves out host roles leaves out declared windows, and from phase 4 every host-owned window

Canvas-space plugins and the canvas code

The canvas code of canvas windows assumes that each canvas window belongs to one Canvas workspace (meta.workspace). A canvas-space plugin is global, like every declared window, and draws on every Canvas workspace at one canvas rectangle. So the split is:

  • canvas_rect and canvas_rects (desktop/canvas_mode.rs:43-51, 728-743) stay the accessors of canvas applications only. canvas_rect returns None for every declared window, as it does for meta.shell today. Everything that moves, sizes, snaps or fits canvas applications uses them, so it never sees a plugin.
  • A new accessor plugin_canvas_rect(window) returns the declared canvas rectangle of a bound plugin with space: canvas, while the active workspace of the primary output is Canvas.
  • The camera funnel takes both. canvas_placement (canvas_mode.rs:68-77) projects canvas_rect through the camera of meta.workspace, and plugin_canvas_rect through the camera of the active workspace of the primary output, never meta.workspace. canvas_clip (canvas_mode.rs:81-86) returns the content area when the root is a canvas window or a canvas-space plugin. Every function below that reads these two then handles a plugin with no change of its own.

The canvas lens (openspec/specs/inverted-sphere-view/spec.md, phase 1) keeps this split. window_lens gives the lens to a canvas root of the active workspace of the primary output and to a plugin with plugin_canvas_rect; the scene puts each run of such items in the band order into one warp group, and the screen-space bands stay flat between the groups. The visibility sites below (canvas_on_screen, canvas_popup_clip, show_canvas_window and the scene cull) test the flat rectangle against the visible region of the lens (flat_overlaps).

Each canvas consumer at e00fb87 and whether it includes canvas-space plugins:

Consumer Location at e00fb87 Plugins
canvas_placement, the projection through the camera canvas_mode.rs:68-77 included, with the camera of the active workspace
canvas_clip, the content-area crop of a window and its dialogs canvas_mode.rs:81-86 included
screen_placement, where a window and its dialogs show canvas_mode.rs:119-148 included, through canvas_placement
canvas_on_screen, used by the focus repair (desktop.rs:1400) and by show_canvas_window canvas_mode.rs:107-114 included: when the focus repair (clear_hidden_focus, desktop.rs:1369-1405) picks a new target, it skips a plugin that the camera puts off screen, as it skips a canvas window. It keeps the current focus when that window is visible and a keyboard_target (desktop.rs:1378-1385), with no canvas_on_screen check, and no pan calls it. So a focused plugin keeps the keyboard when the user pans it off screen, the same rule as a canvas window (openspec/specs/canvas-windows/spec.md, phase 3: "a window that has the focus keeps it when the user pans it off the screen")
canvas_popup_clip, where a popup draws and takes the pointer past its window canvas_mode.rs:92-104, used by hit_in (state.rs:828-843) and the scene (scene.rs:157-168) included, through canvas_clip
canvas_popup_target, the xdg positioner area of a popup (unconstrain_popup from new_popup and reposition_request, handlers/xdg_shell.rs:196-264) canvas_mode.rs:1068-1086 included, changed in phase 3: today it takes the dock of meta.workspace (canvas_mode.rs:1080-1081), and a global plugin's meta.workspace is stale. Phase 3 makes it use the active workspace of the primary output for a plugin, as canvas_placement does, so a plugin popup is unconstrained to canvas::popup_area of the active workspace
canvas::popup_area, the content area without the chat dock canvas.rs:386-400 subtracts each camera_exclusive window (see The chat dock); since 2026-11-02 the whole content area
The scene: draw through the camera, cropped to the content area scene.rs:159, 1031, 1211 (through canvas_clip and screen_placement) included, in their band
The live canvas presentation: culling outside the viewport state.rs:599-620 (canvas_placement) included
Hit testing: the inverse transform and the input threshold hit_in, state.rs:816-854; input.rs:729, 740; click_grab.rs:51 included
Parking origins when a window leaves the canvas (disable_canvas for windows of inactive workspaces, canvas_mode.rs:479-492, and Bind to another workspace, desktop.rs:1618; park_at then calls space.map_element) canvas_origins, canvas_mode.rs:511-520 left out, changed in phase 3: today it filters on canvas_clip, which now includes plugins, so disable_canvas would move and raise a global plugin whose stale meta.workspace is not the active one. Phase 3 makes it take only canvas_window roots and their dialogs, never plugin_canvas_rect. A plugin never parks: Bind refuses declared windows, and the solver places the plugin
The snapshot origin desktop/snapshot.rs:29-32 (screen_placement) included: the plugin reports its projected origin
Visibility: hidden when the workspace is not Canvas visible_window included
A press below the input threshold fits the camera canvas_fit_pressed, canvas_mode.rs:952-956 left out: today it checks canvas_clip, which now includes plugins, so phase 3 changes the check to canvas_window of the root (a plugin never moves the camera)
The camera centering on a focused window show_canvas_window, canvas_mode.rs:1327 left out: it returns early for a plugin, because canvas_rect is None (canvas_mode.rs:1340-1345), so a plugin off screen is not centered. Phase 3 adds a rule instead: an explicit focus (give_focus with explicit, so Alt+Tab, the bar window list and Command::Focus, desktop.rs:1744-1749, which target() lets reach a declared window) of a canvas-space plugin that canvas_on_screen says is off screen does not move the keyboard, and Command::Focus answers "Window is not on screen". So no explicit focus gives the keys to a plugin that is not drawn (AGENTS.md, Canvas layout)
anchor_canvas, the sticky refit on a commit canvas_mode.rs:289-309, called from handlers/compositor.rs:50-51 left out (canvas_window is false for a plugin)
Snap neighbors canvas_neighbors, canvas_mode.rs:151-159 left out
fit_all and the camera clamp canvas_rects, canvas_mode.rs:728-743 and callers left out
restore_canvas_sizes canvas_mode.rs:354-358 left out (a plugin has a declared size)
The sticky refit (refit_target) and the agent and grab move (canvas_move) canvas_mode.rs:315-330, 593-615 left out
The canvas move grab grabs.rs:805 left out (a declared window is never moved by a grab)
The client requests of phase 6 (maximize and fullscreen fit the camera) app_maximize_request, app_fullscreen_request (handlers/xdg_shell.rs:249, 265) left out: a declared window's request is refused, as for every declared window
The snapshot canvas rectangle desktop/snapshot.rs:29 left out; the plugin reports declaration.space: "canvas" and no canvas rectangle
place_canvas canvas_mode.rs:175-249 left out (only undeclared root windows)

The bind check of The window link runs before anchor_canvas and place_web_panel in the commit handler (handlers/compositor.rs:50-54), so the first commit of a plugin already sees its declaration.

The contract of the canvas phases for declared windows:

  • Phase 6 (popups, dialogs and client requests, landed in 88440b0, d4645fb and 937cf7f): the requirement above on the existing code. A popup of a canvas-space plugin follows the plugin through the same camera transform, is unconstrained to popup_area, and takes a hit past its window where canvas_popup_clip allows. A client request (maximize, fullscreen, move, resize) from a declared window is refused.
  • Phase 7 (core, agent tools and persistence): agent move, fit and row, and the window-session persistence of canvas rectangles, use canvas_rect and so never see a declared window. A plugin's position lives only in web-panels.json.
  • Phase 8 (fractional scale and the downscale cache): a canvas-space plugin is drawn with the same scale and cache rules as a canvas application, because it uses the same draw path.
  • Any new canvas code that iterates canvas windows uses canvas_rect or canvas_rects. Code that draws, crops or hit-tests through the camera goes through canvas_placement and canvas_clip, so it handles plugin_canvas_rect with them.

Phase 3 tests: a canvas-space plugin is left out of snap, fit_all, the clamp, canvas_fit_pressed and the snapshot canvas, and is drawn, cropped and hit through the camera; a focused keyboard plugin keeps the keyboard when a pan puts it off screen, and the focus repair after a workspace switch does not pick an off-screen plugin; Command::Focus of an off-screen keyboard plugin answers "Window is not on screen" and the keyboard stays; disable_canvas and a Bind leave a global plugin in place (canvas_origins leaves it out); a plugin popup is unconstrained to popup_area of the active workspace, also when the plugin was declared while another workspace was active; a plugin popup takes a hit past its window.

What stays special and why

  • The chat role. It is a layout member in Grid and Focus, carries the paint marker, is the target of focus_chat and of approvals, and has the dock state. These are behaviors, not stacking. The role is explicit and typed, never a title.
  • The lock. It has its own scene, the ext-session-lock surfaces and the owner rules (openspec/specs/lock-screen/spec.md). The role only replaces the title lookup.
  • The wallpaper. It is the background card of the depth transition and is copied to the extra outputs (scene.rs:474-492, 781-817).
  • The derived bands. floating and raised follow the layout and the presentation, so the compositor sets them. No declaration can ask for them.
  • The protected panel ids. The core keeps the fixed list of checkout assets that may get the overlay band.

Security rules

  1. Only the host connection sends window_declare and window_forget.
  2. Only the main-key routes of the core make declarations. The main key never reaches a renderer, a cookie, a URL, a log or the environment.
  3. A bind needs the host client identity at bind time, a root toplevel, no buffer yet, an exact token title and a token that no live window is bound to.
  4. The role of a window is fixed at its first buffer. A bound window stays bound and an unbound window stays undeclared. The runtime repair makes a new toplevel; it never binds an old one late.
  5. The compositor reads the title only to compare a token before the first buffer, to read the paint marker of the role chat, and to report the title of an undeclared window in the snapshot (empty for a host window with a token title). The app id is read only for the snapshot and the autofocus preference of open question 8. A grep gate test (phase 4), as every_space_location_read_is_listed_with_its_reason does for Space locations, scans the non-test sources and fails on a new read. It has two checks. First, it lists each call of desktop::metadata( (and of the bare metadata( inside native/smithay/src/desktop.rs and native/smithay/src/desktop/) with its reason; it does not match the file-system calls std::fs::metadata, symlink_metadata and file.metadata(). Second, it checks that .title and .app_id of XdgToplevelSurfaceData are read only inside crate::desktop::metadata, so a direct read that skips metadata() also fails the gate.
  6. The token is 128 random bits. It is a correlation id, not a secret: AT-SPI exposes it as the frame name, and processes of the user can read it. The snapshot, the logs and the agent tools do not repeat it. Safety rests on rules 1 and 3, never on the token being unknown.
  7. The band table holds in the compositor, whatever the core sends. Isolated plugins get only desktop or hud.
  8. The lock and recovery stay in bands that no plugin or application reaches, and the lock scene stays the only scene while locked.
  9. Advisory limit: these rules bind applications, plugins, generated HTML and agent tools. A process of the user that execute_command starts can still kill or trace the host and the core (openspec/specs/self-maintenance/spec.md, "What a job can still reach").

wlr-layer-shell as a reference

The compositor does not implement it (no layer_shell in native/smithay/src). It has four layers (background, bottom, top, overlay) with undefined order inside a layer, an anchor bitfield, margins, an exclusive zone, keyboard interactivity (none, exclusive, on_demand) and a namespace that grants nothing. This spec takes the anchor, margin, exclusive zone and keyboard ideas. It adds what layer-shell does not have: a canvas space, an order inside a band, and authority from the host connection instead of from any client that asks.

Binding contract (from AGENTS.md)

This section holds, word for word, the rule that AGENTS.md kept for this feature until 2026-11-10, when AGENTS.md was reduced to the short invariants (openspec/changes/audit-2026-11-10/design.md, F10). It binds exactly as AGENTS.md does; AGENTS.md keeps the short invariant and points here. Change both in the same commit.

  • Window declarations (openspec/specs/window-layers/spec.md, phase 2): the compositor takes window_declare, window_forget and window_status only on the host connection. The core sends them only for the main-key routes /host-window and /host-window-forget, which the Electron main process calls with the host main key in a header; the launch key does not open them. The core builds every declaration from its own templates and registry. No agent tool, generated HTML or trusted page declares, changes or forgets a window, a title or a token. Since phase 4 no title gives a role: a host window that did not bind is an unbound root below the chat, the same title from another client is an ordinary application, and a shell lock is refused without a live lock token. Phase 3 (openspec/specs/web-panels/spec.md, Plugin layers): an isolated panel of web-panels.json chooses only the desktop or hud band (below the chat), its order 0 to 15, its space (screen or canvas) and its input; the compositor refuses any other band for it, and a protected panel takes none of these fields. No plugin draws above the chat or takes its input.