Window layers and declarations (the part that did not land)
The landed part and the current rules are in openspec/specs/window-layers/spec.md. The sections below are the
original text of the doc, unchanged.
Status and decision record
- Status: written on 2026-11-01 on the instruction of the user to apply it now ("pode aplicar o plano agora"), with the recommended defaults of the open questions below. Phase 0 (this document) and phases 1a and 1b (the compositor, landed together on 2026-11-01, see Phase 1 as built) are done. Phase 2 (the host and the core declare) is implemented on 2026-11-01 with a reduced scope; see Phase 2 as built for what it does and what it leaves out. Phase 3 (HUD plugins and the chat dock) is implemented on 2026-11-01; see Phase 3 as built for the corrections to this text. Phase 4 (no title gives a role) is implemented on 2026-11-01; see Phase 4 as built for the corrections to this text. Its precondition (phases 2 and 3 ran for one login in the live session) is not met: phases 2 to 4 are proved in synthetic tests and nested QA only.
- Canvas phase 6 of canvas windows (popups, dialogs and client requests) has landed on main, and this spec states its contract as a requirement on the existing code (see Canvas-space plugins and the canvas code). The implementation runs in parallel with canvas phases 7 and 8. Both touch the same compositor files (state.rs, scene.rs, desktop.rs, desktop/canvas_mode.rs). Each phase of this spec starts from a fresh
origin/main, rebases before it reports, and keeps the behavior of both sides when a conflict comes. - Code references are to
origin/mainat e00fb87 ("docs: record the publish of canvas-phase-6"). Paths without a directory are in native/smithay/src. Canvas line numbers move when phases 7 and 8 land. - Date: 2026-11-01. Owner decision: the project owner.
The user's words (2026-11-01, Portuguese, quoted)
- "Seriam tipo camadas né, teria como em vez de fixar o chat assim a gente posicionasse os elementos considerando camadas e ter camadas que não participam do zoom via alguma propriedade da janela? isso ajudaria a generalizar as regras do HUD sem eles deixarem de serem janelas, ou eles já não são janelas normais?"
- "tem que aplicar isso"
- "pode aplicar o plano agora, não tem como seguir com essa regra que voce fez de identificar pelo título, é péssimo para evoluir o sistema"
- "cada plugin deve ser possivel de adicionar uma camada no hud por conta propria, ter essas props são o que permite configurar os plugins (aplicativos html do hud)."
The user also asked whether this already works ("Já funciona assim né?"). The answer is no:
- The bars, the chat, the wallpaper and the web panels are already normal Wayland windows of the Electron host. They are not a second native UI.
- But no window has a layer, a space or an anchor property. The compositor derives the role of each host window from its title (see Current model).
- A plugin (an
isolateddeclaration in web-panels.json) cannot choose its layer. Every web panel, protected or isolated, sits in the same band (6), above the chat (3) and the bars (5).
Decision
- Every window gets declared properties: a layer (a band of the stack order, plus an order inside the band), a space (canvas or screen), and for a screen window an anchored placement (anchor, margins, size rule). Input and keyboard rules are properties too.
- These properties replace
stacking_key(state.rs:465-492) and the title predicates of desktop.rs:614-656 and session_lock.rs:612-621. - The window title is display text. No role, trust, layer, space or placement comes from it. One opaque token in the title links a new toplevel of the trusted host client to a declaration that only the host control connection can send (see The window link). The title is never parsed for meaning.
- Trust comes from the client identity, as today: the Wayland client of the registered host process (
host_window, session_lock.rs:592-610). - HUD plugins are the web panels of web-panels.json. A plugin declaration sets its own HUD layer and its own properties. The protected host surfaces (the composer and approvals in the chat, the bars, the protected panels, the lock and recovery) stay in bands that no plugin, application, generated HTML or agent tool can reach.
- The canvas chat dock becomes an ordinary screen-space placement of the chat declaration, solved by the same code as the bars and panels.
- With no new plugin field, the current desktop looks and acts the same.
What this decision supersedes
| Old text | Location | New status |
|---|---|---|
"The internal title Agent Native Panel:<id> links the window to the declaration, with no Rust rules per component name." |
openspec/specs/web-panels/spec.md, Declarative contract | Wrong today (web_panels.rs:116-121 and 157-196 have rules per id). Phase 2 copies the per-id rules to the core, phase 4 removes the Rust rules and the title link. Phase 4 rewrites the line. |
| "The chat stays at stacking layer 3, above canvas layers 1 and 2." | openspec/specs/canvas-windows/spec.md, The floating chat | The chat stays in the shell band, above the app, floating and hud bands. The numbers change. |
"stacking_key (state.rs:384-410)" |
openspec/specs/canvas-windows/spec.md:514 | Corrected in phase 1: stacking_key moved to native/smithay/src/layers.rs. |
| "The stacking layers go from back to front: 0 wallpaper, 1 layout app, ... 6 web panels (native/smithay/src/state.rs:384-410)." | openspec/specs/canvas-windows/spec.md:123 | The bands replace the numbers, and the line reference is stale. Phase 3 rewrites the line. |
| "The chat is one trusted Electron window, identified by the host PID and a fixed title" | openspec/specs/canvas-windows/spec.md:118 | The title stops being an identity. Phase 4 rewrites the line: the chat is the window bound to the role chat. |
| "The chat stays the single protected Electron window, with its PID trust, its titles and its per-workspace GPU planes." | openspec/specs/canvas-windows/spec.md:246 | Phase 4 rewrites the line: PID trust and the role chat, and the paint marker as the only title read. |
| "The geometry is limited to the output." | openspec/specs/web-panels/spec.md:33 | Incomplete today: an isolated panel is solved on the output and then clamped into the content area (web_panels.rs:211-229). The spec keeps that rule as confine: content (see Placement). Phase 3 rewrites the line. |
| Every web panel is above the chat | state.rs:466-467 | Isolated plugins move to the hud band, below the chat (phase 3). Protected panels stay above the chat. |
Current model (verified at e00fb87)
Trust
- Trust is already by client identity. The core registers the host pid with
lock_host(web-shell/core/smithay.js:1225-1244). The compositor accepts it only from a child of that pid (ipc.rs:88-103, 272-276). host_window(session_lock.rs:592-610) is true when the Wayland client has the host pid and connected after the host process started.sync_host_trust(desktop.rs:992-998) sets theTrustedShellmark on each window.- The BrowserWindows of the host share one Wayland connection of the Electron browser process. The GTK message box of a host window opens on a second connection of the same process (see the app id clause below).
host_windowis true for both connections. So the trust mark cannot tell the chat, the bars, a panel, the lock and a host dialog apart. Today the title and the app id do that.
Every title and app id rule
Compositor:
| Rule | Location | Matches |
|---|---|---|
desktop_bar |
desktop.rs:614-616 | trusted and title "Agent Native Desktop" |
top_bar |
desktop.rs:618-620 | trusted and title "Agent Native Top Bar" |
desktop_chrome |
desktop.rs:622-625 | either bar |
web_panel |
desktop.rs:626-628 | trusted and title prefix "Agent Native Panel:" (the lock window "Agent Native Panel:lock-screen" also matches) |
wallpaper, passive |
desktop.rs:629-634 | trusted and title "Agent Native Wallpaper" |
shell |
desktop.rs:642-644 | trusted and shell_named |
shell_named |
desktop.rs:648-656 | no trust check: title "Agent Native OS", the workspace marker, either bar, the panel prefix, the wallpaper, or app id "agent-native-os" |
chat_window |
desktop.rs:976-981 | trusted and title "Agent Native OS" or the workspace marker |
panel_spec |
desktop.rs:727-735 | strips the panel prefix and looks the id up in web-panels.json |
PANEL_TITLE, lock_panel_window |
session_lock.rs:52, 612-621 | title "Agent Native Panel:lock-screen" and host_window; read by the lock scene and by the snapshot sessionLock.panelReady (session_lock.rs:556-563, 881-884) |
TITLE_PREFIX, title_workspace, committed |
workspace_web.rs:24-52 | the marker "Agent Native OS [workspace:N]" tags the workspace that painted a chat buffer |
| legacy plain title | scene.rs:667 | "Agent Native OS" without a marker follows the logical plane |
| new window autofocus | desktop/layout.rs:329-338 | title or app id contains "codex", or app id "chatgpt" |
| output at open | outputs.rs:609-626 | host_window or shell_named keeps a window on the primary output |
| snapshot | desktop/snapshot.rs:25, 68-98 | exports title, appId and shell |
WindowMeta::shell (desktop.rs:342-343) caches shell. classify (desktop.rs:791-815) runs again on a title change, an app id change or a trust change (handlers/xdg_shell.rs:48-54).
The app id clause of shell_named does not match the BrowserWindows. The host runs with --class=agent-native-os (scripts/session-supervisor.py:147, scripts/nested-qa.py:477), but Electron 45 on Wayland sends the app id "electron" for a BrowserWindow. Nested run 7d27c66e on 2026-11-01 showed appId: "electron" on all four host windows, and a read-only state query of the live compositor showed the same.
The clause is still live for one documented case. The GTK message box of a host window opens on its own Wayland connection, with the app id agent-native-os, and links to its parent through xdg-foreign (docs/smithay-development.md, Dialogs row; the comment of parent_window, desktop.rs:828-831; the test a_dialog_of_the_shell_on_its_own_connection_centers_on_the_chat, session_lock_tests.rs:2543). The clause makes that box a shell window, so parent_window accepts it as a dialog of the chat from another connection, and it centers on the chat. No nested run on 2026-11-01 opened a real Electron message box, so the app id of the real box is proven only by that test and the earlier record.
The recovery window ("Recuperar alterações") is a BrowserWindow with app id "electron" and no shell title, so it is not shell_named. It is an ordinary layer 1 window that any application can cover.
Web panels by id in Rust, against the claim of openspec/specs/web-panels/spec.md:
- Default glass for
quick-settingsonly (web_panels.rs:116-121). - The drop under the top bar for
quick-settingsandnotification-center(web_panels.rs:157-170). - The toast position of
notifications(web_panels.rs:174-182). - The bottom center of
volume-indicator(web_panels.rs:185-189).
Host and core:
| Rule | Location |
|---|---|
| Fixed window titles | web-shell/desktop.cjs:66-69, 85-91; web-shell/core/lock-window.cjs:74, 84 |
| Title locks (pages cannot rename, except the chat marker) | web-shell/core/host-navigation.cjs:9-15 (titleAllowed), used at desktop.cjs:129-131; the separate check of hardenLockWindow, lock-window.cjs:144-148, which allows exactly "Agent Native Panel:lock-screen" |
| Page titles | web-shell/core/server.js:1659-1666; web-panels.cjs:443-447, 478; vendor/interface/host/lock-screen.html:6; vendor/interface/host/wallpaper.html:5 |
| The marker | vendor/interface/host/workspace-zoom.js:289-314 |
chatWindow |
web-shell/core/desktop-client.js:185-198 |
Bars refused by /api/wm |
web-shell/core/desktop-client.js:483-491 |
| Wallpaper left out of the cover check | web-shell/core/window-capture.js:99 |
| Top bar detection | scripts/nested-qa.py:39, 549 |
stacking_key and the Space order
stacking_key (state.rs:465-492) takes the root of a dialog (root_under) and returns, back to front:
| Key | Windows |
|---|---|
| 0 | wallpaper |
| 1 | everything else |
| 2 | floating |
| 3 | shell (the chat) |
| 4 | the window of a thumbnail motion, or the chat in Palette |
| 5 | desktop_chrome (the bars) |
| 6 | web_panel (every panel and the lock window) |
presented() (state.rs:499-670) sorts by this key with a stable sort (state.rs:521). So inside one key the order is the Space order, and give_focus raises the focused window and its dialogs (desktop.rs:1337, 1343). hit_in (state.rs:816-854) takes the topmost entry of the same list.
Consequences:
- A web panel draws above the chat, the Palette chat and the bars.
Panel::placement(web_panels.rs:211-229) keeps an isolated panel inside the content area, so it cannot cover the bars. Nothing keeps it off the composer or the approval<dialog>s, which live in the chat window (vendor/interface/host/index.html:553, 585, 615). - An isolated panel with
keyboard: truetakes the keyboard at the first show of its toplevel (desktop/layout.rs:271-281), so at each show, because each show is a new toplevel (see Electron 45 on Wayland). - The raise of the chat for each approval (openspec/specs/self-maintenance/spec.md) lifts the chat only inside key 3. It cannot lift it above key 6.
Other role gates on the same predicates
- Workspace scope:
eligible(desktop.rs:944-955) makes ameta.shellwindow global. - Visibility:
visible_window(desktop.rs:1164-1198). A panel hides in the Workspaces presentation and without apanel_spec. In Workspaces only the chat, the bars and the wallpaper show. The chat hides in Immersive when an application exists. - The window overview (
presented, state.rs:523-597): the wallpaper at full output, bars and panels fixed at scale 1, the rest in thumbnails. - Keyboard:
keyboard_target(desktop.rs:736-740) leaves out the wallpaper, the bars and panels withoutkeyboard: true. The lock focus bypasses it (session_lock.rs:730-743). - Input:
hit_inleaves outpassive. input.rs:341-344 (settings_focused), 569-582 (Next), 700-712 and 723-748 (overview and thumbnail clicks) use the same predicates. - Canvas:
canvas_rect(desktop/canvas_mode.rs:43-51) returns None formeta.shell.place_canvas(canvas_mode.rs:175-249) puts the chat atcanvas::dockand filters applications with!shell && !desktop_chrome && !web_panel && !passive && no parent.fit_viewport(canvas.rs:204-219) subtracts the dock. - Layout: the bars are placed in
apply_layout(desktop/layout.rs:357-391), anddesktop_strips(desktop/layout.rs:598-630) reserves 32 and 40 pixels.tiles()(desktop/tiling.rs:121-133) leaves out bars, panels and the wallpaper. In Grid the chat is a member with a 2x2 minimum; in Focus it takesfocus::geometry; in Floating it fills the area; in Canvas it takes the dock. - Scene: the glass set is keyed by role (scene.rs:55-70). The window finish skips shell windows. The slide and depth transitions keep only the bars fixed; the chat and the panels slide with the plane (scene.rs:674-705, 821-909). Previews, planes and signatures leave out shell windows and put the wallpaper last (scene.rs:960-1237).
- Commands and grabs: close, minimize, bind, maximize, move and resize refuse shell windows (desktop.rs:1608, 1763, 1770, 1796; grabs.rs:407). Pair refuses bars (desktop.rs:1693).
send_to_outputrefuses shell windows (outputs.rs:546).effect_target(desktop.rs:956-967) leaves out every host role. - Grid commands:
grid_window(desktop/tiling.rs:594-602) refuses a window when it or its root isshell. It is the one gate of the commandsplace,toggle_floatingandfill_grid, and of Super+Shift+Space. - Workspace check of a command:
target()(desktop.rs:1260-1269) refuses a window of an inactive workspace on the primary output, except ashellwindow, which is global. - First-window focus: the commit handler (handlers/compositor.rs:82-104) gives the keyboard to the first mapped window when exactly one window is not
passiveand notdesktop_chrome. It does not checkkeyboard_target, so today a web panel withkeyboard: falsethat maps alone takes the keyboard, and then the chat does not take it when it maps. - Dialogs:
parent_window(desktop.rs:832-849) lets a shell window be a child only of a shell parent, and a non-shell child of a shell parent only on the same client connection. A shell-classified child of a shell parent may be on another connection: that is the GTK message box of the host above. - Lock:
lock_windowsholds only the lock panel while the owner is Shell (session_lock.rs:664-677).lock_surface_under(session_lock.rs:699-728) reaches only lock surfaces or that window.
The control socket
control_command(desktop.rs:1424-1435) binds onlyunlock,lock_hostandcanvas_enabledto a connection. Every other command is accepted from any process of the user (openspec/specs/self-maintenance/spec.md, "What a job can still reach").SessionLock::host_connection()(session_lock.rs:450) is the connection that registered the host. It is the hook for a command that only the host may send.- A reply to a command carries the whole state (ipc.rs:278-283). An unknown command or field answers id 0 "Invalid request", and the core then disconnects and reconnects (web-shell/core/smithay.js:1036, 1315-1341). So each new command needs a capability that the core checks first, and a field whose values may grow (the declaration) is parsed inside the command (see The typed control commands).
web-panels.json today
- Three parsers read the file. The compositor parses it itself every second (desktop.rs:675-708, web_panels.rs:80-113). The core has one
PanelRegistry(web-shell/core/server.js:160, web-shell/core/web-panels.cjs:325-430). The Electron host has a secondPanelRegistryof the same module (web-shell/desktop.cjs:28-29). The host instance sizes the panel windows and drivesfocusableand the protected toggle (desktop.cjs:96-101, web-shell/core/panel-windows.cjs). All usedeny_unknown_fieldsand version 1. - The host instance refreshes every second (desktop.cjs:215-218). The core instance refreshes at start, on some routes, on the 30 s bar poll (server.js:985-988) and on panel page loads (server.js:1573, 1605), and a page load comes after its window exists. So between refreshes the host and the core can hold different specs for one id.
- They can disagree. Rust accepts
kind: "protected"for any id (web_panels.rs:98). Node refuses an unknown protected id (web-panels.cjs:386-393) and keeps its last valid set. Rust then gives that id the unclamped protected placement. - Plugin fields:
id,title,kind,source_root,anchor(top-right, top-left, bottom-right, bottom-left, center),width,height,offset_x,offset_y,keyboard,auto_open,close_on_blur,fit_content,glass. No field sets a layer, a space or an order. - The live configuration holds only the four protected panels, all
bottom-right. It has no isolated plugin (read-only check, 2026-11-01).
Electron 45 on Wayland (the host side)
- The app id is per process.
setDesktopNameand--classdo not give a per-window app id, and the observed app id is "electron". getNativeWindowHandleis not a Wayland object, and Electron exposes no xdg-foreign handle to the main process. The compositor implementszxdg_exporter_v2(handlers/xdg_foreign.rs). Chromium exports a toplevel only to link its own GTK dialogs (the message box above, and portal or file dialogs) from another connection.- The only per-window string that the main process sets before the first commit is the title.
BrowserWindow.hide()destroys the xdg_toplevel, andshow()makes a new one. Verified in nested run 7d27c66e on 2026-11-01: three opens of quick settings gave window ids 5, 6 and 7, and the window left the state after each close. The compositor assigns an id only innew_toplevel(handlers/xdg_shell.rs:25-46), so each id is a new toplevel. Panels hide and show often (web-shell/core/panel-windows.cjs:28-32, 118-123, 152-158).- Startup creates the wallpaper, the chat, the bars, the automatic panels and the lock poller in one process with no order between their maps (web-shell/desktop.cjs:199-269).
Migration
Five phases after this document (1a, 1b, 2, 3 and 4). Each phase is one branch with its own review rounds, gates and nested QA, and each lands on main on its own. Phase 1 is split in two because it rewrites every predicate caller (state.rs, scene.rs, input.rs, desktop.rs, layout.rs, tiling.rs, canvas_mode.rs, grabs.rs, outputs.rs, session_lock.rs and others) while canvas phases 7 and 8 change the same files. A regression of the refactor and a bug of the new protocol then have separate rollbacks.
Phase 1a: the declaration API in the compositor, no behavior change
- Scope: Rust only. Add the bands and the declaration types. Replace every caller of the predicates of Current model with one API (
declaration(window),band,space,input,keyboard). A single functionlegacy_declaration(window)builds the declaration of a trusted window from today's titles and app id, so behavior does not change. That function holds every title read of the compositor in this phase, apart from the marker and the plain-title check of scene.rs:667, which phase 1b replaces with a role check (The paint marker). No token, no command, no snapshot field, no capability. - Rollback: the previous compositor.
- Tests: the band order and the stable inner order; a test that each legacy title gives the same
(band, keyboard, input, space)as the old predicates; every existing behavior test passes unchanged. Each new test fails when its rule is removed. - Nested QA: the standard desktop, quick settings open and close three times, a Canvas workspace with the dock, all the same as before.
Phase 1b: tokens, commands, the solver and the capability
- Scope: Rust only. The token table, the bind rules,
window_declare,window_forgetandwindow_statuson the host connection (with the raw declaration parse and its typed refusal), the solver with both clamp modes andwith_top_bar, the snapshot fields (declaration, the title rule of step 8,windowDeclarations, andshellas the legacy predicate or a declaration), andcapabilities.windowDeclarations.shellandWindowMeta::shellkeep today's value for every window that is not bound. - Every compositor use of a bound declaration is in this phase, so the capability means full support and phase 2 has no Rust change.
declaration(window)returns the bound declaration first andlegacy_declarationonly for an unbound window, so every caller of the phase 1a API uses it: the band, visibility (visible_windowshows a bound panel with nopanel_spec), keyboard and input, glass, the chat role, the bar edge, andsessionLock.panelReady(Snapshot fields), the panel placement (place_web_panelsolves a bound panel from its declared placement and ignores its entry in web-panels.json, where todaypanel_specgets the id from the title prefix, desktop.rs:727-735, and a bound panel has the token title). The role check of the paint marker (The paint marker) is also in this phase. - The one behavior change of this phase is the first-window focus (handlers/compositor.rs:82-104): a window with
keyboard: noneorinput: nonedoes not count as the first window, and the target must passkeyboard_target. So a toast withkeyboard: falsethat maps alone no longer takes the keyboard, and the chat that maps next does. This applies to legacy windows too. Every other window looks and acts as before. - Rollback: the compositor of phase 1a. Nothing declares yet.
- Tests: each refusal of the command table, including one refusal per role-only property of the band rules table, and "Invalid window declaration" with the connection kept open;
window_statusof a token before and after its map and after its window is destroyed;panelReadyfalse for an unmapped lock window and true once it maps; bind before the first buffer only; the first-window focus with the chat and the notifications toast mapped at startup in both orders (the chat takes the keyboard, the toast never does); a bound panel with a token title is shown, placed from its declaration and keyed from it, with no entry match on the title;lateBinds; one live window per token; a re-created toplevel binds again; the lock token re-binds after its window is destroyed; a foreign client with a token title stays undeclared; an update in place; the solver againstcanvas::dock(clampsize) andrectangle_with_client(clampmargin) on outputs smaller than size plus margin, and on client sizes that include (0, 0); thewith_top_barswitch at runtime; the fixture of the phase 2 core declarations (Version skew) declared and shown at the old rectangles;shelltrue for a bound window and unchanged for every other window. Each new test fails when its rule is removed. - Nested QA: as phase 1a;
windowDeclarationspresent;shellthe same on every window as in the phase 1a run.
Phase 1 as built (2026-11-01)
Phases 1a and 1b landed as one change. These points correct the text above; the work log (docs/work-log-2026-11.md, "2026-11-01: window layers phase 1") has the reasons.
- The dialog rule for host connections moves to phase 4. A bound shell window is always a root (
parent_windowgives it no parent), and other dialogs keep the rules of today. The rule keys on the host pid, and every client of the test harness has that pid, so the existing test that another client cannot parent a window to the shell failed with it. No window declares before phase 2, so the rule has no user yet. - The solver places a bound panel and a bound recovery window. A bound bar, wallpaper, chat and lock keep the placement of the existing layout code (
desktop_strips, the wallpaper and lock rectangles, the chat layouts). The declared placement of a bar must still name an edge, and the edge selects the bar. The host declarations of Declarations of the host windows give the same rectangles, which a compositor test checks with native/smithay/testdata/host-declarations.json. exclusive,camera_exclusiveandpaints_workspacesare checked (range and role) but not used yet: the layouts keep the fixed strips of 32 and 40, andfit_viewportandcanvas::popup_areakeep the dock rule. The phase that first needs another value (phase 3 forcamera_exclusive) changes these callers. Phase 1 treats every bound chat as the painter: the role check ofweb_content_matches(The paint marker) applies to every window of role chat, bound or legacy, andworkspace_web::committedreads the marker of every root commit. Phase 4 reads the flag.space: "canvas"is refused with "Invalid window placement" until phase 3 (capabilities.hudPlugins).- The refusals come in this order: the host connection, the token form, the parse ("Invalid window declaration"), the lock, the role of a live token, the token limit, then the checks of the declaration alone (an invalid range, then the layer, then a role-only property, then the placement), then one window per role. A
panelobject on a role that is not panel answers "Property not allowed for this role"; a panel with nopanelobject answers "Invalid window declaration". - A late bind is a host window that has a live token title after its first buffer: by a title change after the buffer, or by a
window_declareof a new token that comes after the buffer of a window with that title. It is counted once per window. A commit of a window that has the token title and a buffer does not count. window_statusis true only when the bound window carries the live declaration of the token. A window keeps the declaration of a forgotten token for its life and still holds that token, so a new declaration of the token reports false while that window lives, and no new window can bind to it.pairrefuses a host surface with "Host surface is outside the workspace layout" (it said "Desktop bar" for every fixture role).- The old stacking key 6 held both the panels and the lock. They are now
overlay(9) andlock(10); they exist together only while locked, when only the lock scene draws. namemust have 1 to 256 characters, a panel id the form of web-panels.json, andglassthe ranges of web-panels.json.- More refusals with "Property not allowed for this role", so the band table holds against a core bug or a bad template (security rule 7):
input: nonewith a keyboard other thannoneon any role (hit tests never reach such a window, so it must not hold the keys); a wallpaper or a bar with a keyboard other thannone; a chat or a recovery window with an input other thannormalor with keyboardnone(the composer and the approval dialogs live in the shell band, so it must take the clicks and the keys); and, untilcapabilities.hudPlugins(phase 3), an isolated panel withinput: noneor an order other than 0. An isolated panel sits in overlay above the composer and the approvals until phase 3, so a click-through panel there could cover the approve button, and an order above 0 would keep it above the protected panels. Phase 3 removes the isolated refusals when it maps isolated overlay to hud. window_statusandsessionLock.panelReadytest whether the bound window has a buffer now, the same test as the lock scene.WindowMeta::bufferedstays true after a null-buffer unmap and only says that the window can no longer bind.- The first-window focus is not the only change for legacy windows, as Phase 1b above and the
shelltext of Snapshot fields say. There are four: (1) a panel that takes no keyboard (the notifications toast) or the lock window no longer counts as the first window, while the bars and the wallpaper were already left out; (2)pairrefuses every fixture role (bar, wallpaper, panel, lock, recovery), not only the bars; (3)sessionLock.panelReadymeans a lock window with a buffer, not one that exists; (4)web_content_matchesfollows the logical plane for a legacy chat that has a workspace marker title and no painted marker yet, where before only the plain title "Agent Native OS" did. legacy_declarationdoes not hold every title read of this phase. The paint marker of the chat, the token compare of the bind, the snapshot title (desktop/snapshot.rs) and the Codex autofocus of desktop/layout.rs (open question 8) read the title outside it; the autofocus also reads the app id of an undeclared application, which the spec allows until phase 4. Every other caller (choose_outputincluded) reads titles throughlegacy_declaration.- Nested QA (nested proof only): a run of origin/main and a run of this phase took the same steps (the standard desktop, quick settings opened and closed three times, a Canvas workspace with the dock and GNOME Calculator). Every window kept its
shellvalue, geometry, visibility and focus; the phase addswindowDeclarationsanddeclaration: null. The work log entry "window layers phase 1, nested QA" has the details.
Phase 2: the host and the core declare
- Scope: the main key, the host-made tokens,
/host-windowwith its seven decisions,/host-window-update,/host-window-status, the forget queue, the core templates and protected defaults (the per-id rules copied to the core; the Rust rules stay for the fallback until phase 4),declareWindowandforgetWindow, the host tokens for every window (LockWindows first and the lock token at start, recovery in the open handler), the pending state of PanelWindows, the chat fallback, the runtime repair, the Smithay-only branch of the host, the panel spec from the/host-windowanswer, the core consumers ondeclaration, and the grep test of.shellreaders. No Rust change: the compositor of phase 1b already places, shows and keys a bound panel from its declaration. Add one AGENTS.md Boundaries line for window declarations:window_declareandwindow_forgetonly on the host connection; declarations only from the main-key routes of the core (/host-window,/host-window-update,/host-window-forget,/host-window-status); no agent tool, generated HTML or trusted page declares, changes or forgets a window, a title or a token. - Rollback: the previous host and core. The compositor of phase 1b reads the titles of an unbound window, and an older host binds nothing.
- Tests: the main key on descriptor 3 and refused routes without it; a
/host-windowretry after a lost answer gives one live token; the per-token order of declare and forget; templates; the four protected defaults against the old rectangles; the core templates against the phase 1b fixture native/smithay/testdata/host-declarations.json; each decision of/host-window; the chat fallback after 10 s on "connecting" and its replacement on "declare", which keeps the bars, the wallpaper and the panels; no fallback on "locked"; no/host-windowrequest without Smithay; LockWindows started before the chat; a second open of a pending panel; the lock and chat repair; panel re-declare through/host-window-update(the host applies only the answer's spec, and a host registry change with no answer yet changes nothing), each of its answers, and forget; a kind flip gives a new window and token; the re-declare at unlock; one test per.shellgate; consumers by role. - Nested QA: every host window has a
declarationand the snapshot title is its name;lateBinds0; quick settings binds again on each show;key Super_L+lshows the lock window bound to the role lock (the unlock needs PAM and a password, so the nested run does not exercise it;stopends the locked run); the look is the same as a capture of the phase 1b run.
Phase 2 as built (2026-11-01)
These points correct the text above; the work log (docs/work-log-2026-11.md, "2026-11-01: window layers phase 2") has the reasons. No Rust change: the phase 1b compositor already places, shows and keys a bound panel from its declaration and ignores its entry in web-panels.json (anchored_rect, layers.rs).
- The main key: web-shell/desktop.cjs makes a second 32-byte key and sends it on descriptor 3 as the second line after the launch key; core/launch-key.js reads both and refuses a bad main key, a third line and a main key equal to the launch key. The routes take it only in the header
x-agent-native-host-keyand refuse any request with anOriginheader. - Routes:
POST /host-window {surface, panel?, token?}andPOST /host-window-forget {token}only. The surfaces arewallpaper,bottom-bar,top-bar,chat,recovery,lockandpanel. The answers are{decision: "declare", token, spec?},{decision: "legacy"},{decision: "wait", reason: "connecting" | "locked"}(one decision for the "connecting" and "locked" of Core changes; the host retries both every 500 ms),{decision: "unknown"},{decision: "refused", error}and{decision: "replace"}. The forget answers{decision: "forgotten"}(also for "Unknown window token"),waitorrefused. (Phase 4 as built: "legacy" is gone, and "unsupported" exists as a wait reason,{decision: "wait", reason: "unsupported"}.) The core waits with "connecting" also while the compositor reports no registered host (sessionLock.hostRegistered), becausewindow_declareneeds the host connection. /host-window-updateis not a separate route: a re-declare is/host-windowwith the live token of the window. The per-token order, the refresh of the core registry and the answers "declare", "replace" and "unknown" are the same as the spec gives for/host-window-update.- Not implemented in phase 2:
/host-window-status,lockBoundin/lock-state, and the runtime repair of an unbound chat, bar, wallpaper, panel or lock window; the chat replacement (a fallback chat stays the chat for the life of the host); the re-declare of every live panel token at the unlock (a panel re-declare that gets "locked" retries every 500 ms instead); the grep test of.shellreaders and the per-gate tests; the host test of the non-Smithay branch (desktop.cjs needs Electron; the branch isif (!hostWindows) return createWindow(route)). A token title that does not bind leaves the window with no role on a phase 1b compositor; the nested run of this phase hadlateBinds0. - The chat and recovery fallback: after 10 s of "wait" answers with "connecting" and no "declare" or "legacy", the host stops asking and creates the chat with the fixed title "Agent Native OS", or recovery with "Recuperar alterações". A refused chat or recovery declaration also falls back at once. On "locked" there is no fallback, and a "locked" answer starts the 10 s again: the time locked never counts. The fallback forgets the token it sent, because a declare whose answer got lost can leave it in the compositor. Recovery has one pending open at a time: more clicks during the wait get the same open. The decision logic is
openHostSurfacein core/host-windows.cjs, with host tests (host-windows.test.js); desktop.cjs only passescreateWindowand thealivecheck. - A panel whose declaration fails ("unknown", "refused" or an error) gets no window and is logged once; an automatic panel asks again only when its entry in the host registry changes. A second open (a toggle) of a pending panel cancels the open and forgets the token when the answer comes; a
?showopen of a pending panel keeps it. - Every host window forgets its token on
closed: the wallpaper, both bars, the chat and recovery (openHostSurfacein core/host-windows.cjs) and each panel window (panel-windows.cjs). Only the lock keeps its token for the life of the host. A refused bar or wallpaper window is not created and is logged once per open. desktop_stateaddsroleto a declared host window (the declared name stays its title); it reports no token and no other declaration field.- Accessibility: not checked. The nested run has no session bus, so the AT-SPI dump of the frame names did not run.
- Nested QA (nested proof only): run 56b6243a. Every host window had a
declarationand its declared name as its title,lateBindsstayed 0, quick settings bound again as windows 5, 6 and 7 at (1506, 40) 390x418 on three shows, Super+L showed window 8 bound to the role lock withpanelReadytrue and the keyboard, and the desktop and quick settings captures look the same as the phase 1 captures. The compositor refuses a capture while locked, so the lock has no capture.
Phase 3: HUD plugins and the chat dock
- Scope:
capabilities.hudPlugins; the plugin fields in web-panels.cjs, in the compositor validation and in the web_panels.rs fallback parser; isolated plugins in the hud band by default (below the chat), and an isolated declaration in overlay mapped to hud; the keyboard rule of the low bands;plugin_canvas_rectand the canvas consumer table;layer,order,space(including canvas-space plugins), the new anchors andinput; the chat dock as an anchored placement withcamera_exclusive; openspec/specs/web-panels/spec.md and openspec/specs/canvas-windows/spec.md; the AGENTS.md line of window declarations extended for plugins (a plugin chooses only the desktop and hud bands and its own properties, never a host band). - Rollback: the previous host, core and compositor. A file with the new fields is refused by the older side; remove the fields first.
- Tests: each field and refusal on both sides; two plugins with different orders stack in order; a hud plugin under the chat and above an application; an isolated declaration in overlay binds in hud (as built: is refused); a covered keyboard plugin does not take the keyboard at its show, and a click on its uncovered part gives it the keyboard; a canvas-space plugin pans and zooms with the camera, is hidden outside Canvas, takes input through the inverse transform and is left out of snap,
fit_all, the clamp and the snapshotcanvas;fit_viewportwith the dock as before. - Nested QA: a synthetic isolated plugin in the private web-panels.json of the run, with
layer: hudandorder: 2, and a second one withspace: canvas; GNOME Calculator on the nested socket as the application; the plugin draws above the Calculator and below the chat, a click on the chat over the plugin reaches the chat, the canvas plugin follows a pan and a zoom; the protected quick settings still shows above the chat.
Phase 3 as built (2026-11-01)
These points correct the text above; the work log (docs/work-log-2026-11.md, "2026-11-01: window layers phase 3") has the reasons.
- Overlay is refused for an isolated panel ("Layer not allowed for this role"), not mapped to hud. A map would let a declaration name one band and get another; a refusal fails closed. The cost: a phase 2 core on a phase 3 compositor (a host and core rollback) gets no window for an isolated plugin. A phase 3 core declares in hud only when the compositor reports
capabilities.hudPlugins, and in overlay otherwise, so it never meets this refusal. - The declaration property decides the camera exclusion, and the dock state gives its shape.
camera_exclusivetakes one value,dock, and only the chat may declare it; the phase 3 core declares it on the chat. The compositor builds the dock placement and its exclusion from the dock state (canvas::dock_placement,canvas::dock_exclusion), andfit_viewportandpopup_areasubtract the list thatCompositor::camera_exclusionsreturns: one dock exclusion while a mapped top-level window declarescamera_exclusive. A chat of the fixed title (an older host) keeps the exclusion, as before declarations. A bound chat without the property (a phase 2 core) gets none, so after a core rollback alone the camera fit can go under the chat. An edge value comes with the first role that needs one; no plugin can declare the property, so no plugin can shrink the camera viewport of another window. - The exclusion holds only while the chat window is mapped. While the host reloads or restarts, a layout pass that fits a sticky target, or an agent fit, uses the whole content area, and the camera moves again when the chat maps. This is the rule of the property (no window, no exclusion); openspec/specs/canvas-windows/spec.md records it.
- The solver gives the old dock rectangles on content areas from 25 px wide. Below that the old code put the right dock left of the content area, and the solver keeps it at the left margin. No real output is that narrow.
Command::Focusof a desktop or hud window that a higher band covers answers "Window is covered by a higher layer", and of a canvas plugin that the camera puts off screen "Window is not on screen". The keyboard stays where it is in both cases. Theon_showfocus at a show skips a covered plugin without an error.- A canvas-space plugin parks at the top-left of the content area in the Space; it is drawn and hit only through the camera. The window overview drops canvas plugins, because they draw only through the camera of a live canvas. Screen plugins stay fixed in the overview, as panels.
- The web_panels.rs fallback parser takes the plugin fields with the rules of the core and ignores them for placement, as the spec says.
- The core reads
capabilities.hudPluginsfrom its compositor connection. Before the core has the state of a connected compositor (the startup), the capability is unknown, and the core registry keeps a file with plugin fields; it refuses the file only when a connected compositor reports nohudPlugins. Every panel declare refreshes the registry and checks the capability again, so an unknown capability never sends a plugin field to a compositor without it. input: nonewithkeyboard: trueis refused on both sides: a window that no press reaches takes no keyboard.- Not implemented: the AT-SPI check of the plugin frames (the nested run has no session bus), and a popup test of a canvas plugin (the consumer table rule is in
canvas_popup_target; a test client with popups on a declared panel is not in the harness).
Phase 4: remove every title rule and the fallbacks
- Scope: delete
desktop_bar,top_bar,desktop_chrome,web_panel,wallpaper,passive,shell,shell_named,chat_windowby title,panel_spec,PANEL_TITLEandlock_panel_windowby title,legacy_declaration, the compositor reader of web-panels.json (web_panels.rs parse and the per-id rules), the title comparison of scene.rs:667 (the role check of The paint marker stays), the app id clause ofshell_named(the host dialog rule of phase 1b replaces it),shell_namedinchoose_output, the title clause of the Codex autofocus (open question 8), the fixed titles and the "legacy" decision of the host (except the two compatibility titles: the legacy lock title on "unsupported" and the fallback chat title, Version skew), and the title fallbacks of the core and nested-qa.py.shellstays in the snapshot and becomes the host-owned predicate, and undeclared host-owned roots take the derivedunboundband (Snapshot fields). Rework the tests that build windows by title (session_lock_tests.rs, window_grab_tests.rs, grid_tests.rs and others) to declare them through a test helper, includinga_dialog_of_the_shell_on_its_own_connection_centers_on_the_chat(see How the parts use the model, Dialogs). Add the grep gate of security rule 5. Update openspec/specs/web-panels/spec.md, openspec/specs/lock-screen/spec.md and docs/smithay-development.md, and change the AGENTS.md Boundaries line of window declarations to say that no title gives a role. Add the two capability checks of the persistent plan (Version skew) to AGENTS.md, section Host/core maintenance, and to openspec/specs/self-maintenance/spec.md: deploy a phase 4 host and core only when the live compositor reportscapabilities.windowDeclarations, and refuse a host and core from before phase 2 when it reportscapabilities.declarationsRequired. Add a read-only check script (scripts/check-host-skew.py) that readscapabilitiesfrom onestatequery of the control socket, as scripts/smithay-pointer.py does, and exits non-zero on a refused pair, with a Python test; the persistent plan of a maintenance restart runs it. - Rollback: the compositor and the host of phase 3 together (see Version skew).
- Tests: the grep gate; every behavior test passes with declared windows; a trusted window with "Agent Native OS" as title and no token is an undeclared host-owned root in the derived
unboundband, withshell: true, that refuses minimize, maximize, place, toggle_floating and fill_grid from the control socket (and Super+Shift+Space) and draws above a hud plugin and a floating application and below a declared chat; an isolated panel whose declare is refused gets no window, and one that binds late is closed by the host and, until then, never draws above the chat or takes a click on the composer; a DevTools window of the host is the same, with each visible effect of Snapshot fields; a foreign window with that title is an ordinary application withshell: false; the host GTK dialog on its own connection is a dialog of the declared chat. - Nested QA: as phase 2, plus a plain client titled "Agent Native Desktop" on the nested socket stays an ordinary window.
Phase 4 as built (2026-11-01)
- The compositor reads no title and no app id to give a role.
legacy_declaration, the title predicates and web_panels.rs (the parser of web-panels.json, the per-id rules and the moves of the legacy defaults under the top bar) are gone, with the snapshot fieldwebPanelsConfigError. A trusted host window that did not bind getslayers::UNBOUND: the role and bandunbound(between hud and shell), input normal, keyboardon_demand(a fallback chat must still take typing), no glass, no strip, no paint marker, and the centered placement of Snapshot fields. Every window gate refuses it with "Shell is protected", as for a declared window.shellin the snapshot stays the host-owned predicate. - Security rule 5: the source test
every_title_read_is_listed_with_its_reason(window_layers_tests.rs) scans every non-test source file. It lists eachmetadata(read with its reason (the token compare ofbind_windowin layers.rs, the paint marker ofworkspace_web::committed, the snapshot title and the Codex autofocus of desktop/layout.rs) and checks that.titleand.app_idare read only insidedesktop::metadata. The Codex autofocus reads the app id only (open question 8). - The paint marker:
workspace_web::committedreturns before it reads the title unlesslayers::paints_workspaces(window), the bound chat. A host window with a marker title and no token paints no workspace. - The shell lock (
lock_session, Super+L and the controllock) is refused with "No lock window is declared" while the registered host holds no live token of role lock (lock_declared). A lock of an ext-session-lock client is not affected. - The snapshot reports
capabilities.declarationsRequired: true. - The core: without
capabilities.windowDeclarations/host-windowanswers{decision: "wait", reason: "unsupported"}(one decision with the other wait reasons, as in Phase 2 as built), and/host-window-forgetanswers "forgotten", because such a compositor holds no token. The "legacy" decision is gone.windowRole,barEdgeandchatWindowread the declaration only. - The host: on "unsupported" the chat and recovery fall back, as plain windows with the display titles "Agent Native OS" and "Recuperar alterações", after 10 s, and the host logs the version skew once per host. Correction: the spec says every surface waits except the chat; recovery falls back too (review round 1), because it is the escape hatch and an older compositor reads its title. The 10 s count starts again when the wait reason changes.
- The chat replacement (review round 1): a plain chat of a "connecting" fallback is no chat for a phase 4 compositor (an unbound root, no dock, no glass, no paint marker, and
chatWindowfinds none). So the host keeps asking/host-windowwith a new token while the plain chat and the host live, and on "declare" opens the declared chat; desktop.cjs moveschatto it after its first load and closes the plain one, and that close ends no bar, wallpaper or panel (adoptChat,replaceChat). Review round 2: before the swap the declared chat loads the route of the plain chat, with its query and fragment, so a recovery page that the native menu opened in the plain chat stays open (swapChatin core/host-windows.cjs, with a test on fake windows). A failed load of that route closes the declared chat and keeps the plain one. An unsent composer text of the plain chat does not move: it lives in the sessionStorage of the plain window. A throw in the background ask is logged, never an unhandled rejection. A fallback on "unsupported" or on a refusal is not asked again. This corrects Phase 2 as built, where a fallback chat stayed the chat for the life of the host. A declared chat whose load fails stays open beside the plain one. LockWindows uses the legacy lock title on "unsupported" (desktop.cjsprepareTitle). Panels, the bars and the wallpaper open no window on "unsupported". The fixed bar titles of the host (barTitles) are gone; the bars take their declared names. - scripts/nested-qa.py finds the top bar by its declaration only.
- scripts/check-host-skew.py runs the two capability checks of Version skew with one read-only
statequery. Correction: the spec defines "before phase 2" by the absence of web-shell/core/window-declarations.js; the script also needs to tell a phase 4 checkout, and it uses the presence of the script itself as that marker, so the check needs no version file. Exit 0 allows the pair, 1 refuses it and 2 means the check could not run. - The tests declare their windows. The harness of session_lock_tests.rs declares a host window by its name (
declare_host_window,map_declared), takes the lock token before a shell lock (shell_lock,declare_lock) and names a window by its declared name (title_of,named). Tests that checked a title rule now check that the title gives no role: a host window titled as the chat with no token is an unbound root, an application titled as the bottom bar stays an ordinary window, a shell lock with no lock token is refused, and only the bound chat paints a workspace by its marker. Each new test fails under a mutation that restores the title rule it guards (the work log has the list). - The shell lock gap (review round 1): every change of the host identity drops the tokens, so after a host or core restart a shell lock is refused until the new host declares its lock token. Super+L in that gap waits up to 10 s (
PENDING_LOCK) for the declare of a lock token and then locks (lock_key,pending_lock_declared); the controllockdoes not wait, and the core asks it again every 250 ms for up to 5 s (SessionLock.lock). - Not implemented: a DevTools window has no dedicated test; it takes the same unbound path as any undeclared host-owned root. The host does not close a panel window that bound late or never bound (the test list above says it does): the runtime repair of Phase 2 as built is still not implemented, so such a window stays in the
unboundband for its life, and no gate lets the agent close it. Nested QA recordedlateBinds0.
Validation plan
- In-process tests in each phase, as listed above. The Rust harness gets a helper that declares a test window through the control command on the host connection.
- Node tests for the main key, the routes, the templates, the plugin validation and the consumers, with
testEnvironment. - Nested QA (
scripts/nested-qa.py) in each phase. It is nested proof only: one output, no gestures, no provider. Captures stay outside Git. - The live check needs the user and
coordination.lock: the look of the live desktop, two monitors, and a login with a phase 4 compositor and host. It is not part of these phases.
Open questions, with the defaults that this work applies
- Where do isolated plugins go relative to the chat? Default: the hud band, below the chat and above applications. Protected panels stay in overlay, above the chat.
- May the paint marker stay in the title? Default: yes, as paint data on the role chat only, because it is the only channel that Electron orders with the buffer commits. It grants nothing. Revisit if Electron gives another in-band channel.
- One token per
BrowserWindow, or one per show? Default: one perBrowserWindow.hide()andshow()re-create the toplevel (verified), and Chromium sends the stored title again. - Does the recovery window move to the shell band? Default: yes, centered and global. It is a behavior change on purpose, like the derived
unboundband of undeclared host-owned roots in phase 4 (which sits below the chat). - May plugins use canvas space? Default: yes, on every Canvas workspace at the same canvas rectangle, hidden elsewhere.
- May plugins reserve an exclusive strip or a camera exclusion? Default: no. They would move the content of every layout.
- May a plugin be per workspace? Default: no, plugins stay global, as panels today.
- What happens to the Codex and ChatGPT autofocus (desktop/layout.rs:329-338)? Default: phase 4 removes the title clause and keeps the app id clause. It is a focus preference for ordinary applications, with no trust or layer.
- Should
bar_glass,chat_glass,chat_dock,chat_dock_sideandoverview_planesalso need the host connection? Default: not in this work. A separate change can bind them, as these phases do for the declaration commands. - What do undeclared host windows (DevTools, message boxes) get? Default: no role of their own. Until phase 4 a DevTools window is an undeclared app-band window. From phase 4 every undeclared host-owned root takes the derived
unboundband and the gates of a declared window, so a host window that failed to bind is never coverable or movable. A GTK message box on its own host connection, linked through xdg-foreign to a declared parent, is a dialog of that parent and takes its band. Both areshell: truefrom phase 4.