Skip to content

TASK-2771: a linked box's desktop in the kiosk is laid out by the kiosk's monitors (experimental, off by default) - #1566

Draft
yalexx wants to merge 2 commits into
betafrom
TASK-2771-kiosk-viewer-screens
Draft

yalexx wants to merge 2 commits into
betafrom
TASK-2771-kiosk-viewer-screens

Conversation

@yalexx

@yalexx yalexx commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

TASK-2771 — a linked box's desktop in the kiosk is laid out by the kiosk's monitors

Draft. Experimental, off by default. Needs a real two-monitor check (steps below) before it leaves draft.

The problem

On an x64 ClawBox whose screen is the "ClawBox Desktop" session with two monitors, Ctrl+Shift+2 (Linked ClawBoxes) shows the other box's desktop in a tab of the kiosk Chrome — stretched over both monitors as ONE screen. The desktop lays itself out from GET /setup-api/monitors of the box that serves the page (use-monitor-layout.ts → desktop-screens.ts); inside another box's kiosk that answer is the wrong box's monitors, or available: false.

What this does

A second switch, Settings → System update → Advanced options → "Linked ClawBoxes use this ClawBox's monitors (experimental)" (box preference ui_linked_boxes_screens, default off, built exactly like ui_linked_boxes: preference, clawbox:linked-boxes-screens-flag event, extension storage, all ten languages, i18n scan clean). It does nothing unless Linked ClawBoxes is on as well.

With it on, the kiosk extension (1.8.0) carries the kiosk's own monitors to the linked box's page:

  1. The kiosk's own desktop script reads its box's /setup-api/monitors (same origin, owner's session) when the worker asks (readMonitors). The second switch is read in the same request as the first.
  2. A page of another box in the kiosk asks the worker (viewerScreens) the moment it is shown and every 3 s while it stays shown (one read at a time, nothing while hidden) and writes the answer into <html data-clawbox-viewer-screens>.
  3. The worker answers only a page whose own address (sender.url) is on the origin of one of the owner's linked boxes in its session-bound copy of the list, only while the second switch is on, and nothing if the list is forgotten, runs out, or drops that box while the desktop reads. It hands over geometry only, rebuilt value by value (cleanScreens): the connector name as id (a monitor's own id carries make, model and serial), where each monitor that is on sits and how big, which is main, the row's size, mirror. Frames, the extension's own pages, the kiosk's own origins and other sites get nothing.
  4. The page (parseViewerScreens, useViewerMonitors) validates the mark at least as strictly as recallMonitorStatus (plus: ≤ 8 KB, ≤ 16 monitors, printable ids ≤ 64 characters and no repeats, every number finite and bounded) and rebuilds it; a mark that fails is no mark. A valid one goes through the same screensFromStatus rule as the box's own layout — windows maximise/snap per monitor, shelf/chat/icons/notices/modal scrims on the main monitor, a window that is not laid over the kiosk's whole row is one screen — re-applied on every change and resize, in a display-mode: browser window too. The page then never reads its own box's monitors; a kiosk with no layout is one screen, not the box's own.
  5. Settings → Monitors on a box shown that way draws ViewedMonitors instead of the panel: the kiosk's monitors, read-only (connector, size, main), under one line saying they are arranged in Settings → Monitors on the ClawBox that runs this screen. The box's own outputs are not read, drawn or changeable there (the panel is not mounted: no poll, no brightness read, no Apply).

Unchanged: switch off (all pages), a box's own kiosk desktop, a desktop in an ordinary browser tab, Jetson boxes, /updating (its recall ignores the mark). Docs: docs/agents/desktop.md, docs/agents/settings.md, docs-site/whats-new.mdx (4.3 "Smaller things").

Tests and checks run (on 4065c82ef)

  • node_modules/.bin/vitest run --config vitest.config.ts kiosk-extension use-monitor-layout desktop-screens box-switcher monitors-panel settings-update-section settings-monitors-row desktop-linked-boxes-flag i18n-sweep-catalogue translations visible-interval public-hygiene shell-regex-hygiene --maxWorkers=2 → 18 files, 836 tests passed.
  • New/changed tests: extension runtime (page side: polling, hidden, switches, not-a-linked-box, own pages excluded, readMonitors; worker side: gate by origin / sender.url / switch / list gone or out of date / list forgotten or box removed mid-read, geometry-only output, bad numbers, no desktop tab, deadline, worker→page round trip), extension source pins + RELEASES 1.8.0, parseViewerScreens table + hook (own→viewed→own, no own read, one screen cases, /updating's recall), Settings → Monitors viewed branch, the new switch.
  • RED against origin/beta sources: workspaces.js → 14 tests fail, background.js → 6, SettingsApp.tsx → 3; green with the change.
  • eslint on every touched file: 0 errors (6 warnings already on beta).
  • tsc: the whole-project run runs out of memory on this build box (3 GiB heap). A tsc over every touched .ts/.tsx file and what they import has no error in them; its only errors are 6 that exist on beta (node:sqlite ×5, js-yaml types ×1).
  • bun run i18n:scan → 0 missing / 0 identical / 0 untranslated; bun run gen:translations regenerated the chunks (2 lines per locale).
  • One Jetson lab board rebuilt to this branch at the pushed sha: gateway and setup active, dashboard answers, the built bundle carries the change, extension folder is 1.8.0, preference and monitors routes answer 401 signed out; rebuilt back to main and released. (Monitor mode never runs on a Jetson; this only shows the flag-off build starts and serves.)

NOT verified

  • Nothing here has run on two real monitors or in a real Chrome (not allowed on the build box). The whole chain extension → worker → page → layout is proven only by jsdom runs of the real scripts against a stand-in chrome.
  • Whether the linked box's tab, in the labwc session, is a window whose size is the kiosk's whole row (the layout rule needs the window to have the row's proportions; anything else is one screen by design), and whether chrome.tabs.query({ windowType: "normal" }) finds the desktop in that session.
  • The extension's 40 px bar over the linked page (pre-existing for pages in the kiosk: offset.js moves the page's fixed boxes down) is not compensated: per-monitor maximised windows may sit 40 px low/overhang the bottom, exactly as one-screen maximised windows already do there.
  • The second runtime (OpenClaw vs Hermes) was not switched on the board; only one board was free and the board helper cannot switch runtimes.
  • The full vitest suite and the full-project tsc were not run.

Manual check (needs two monitors on box A; any second box B on this branch, reachable from A)

  1. Put this branch on both boxes (Settings → System update → Advanced options → branch), then restart A's kiosk Chrome: Chrome re-reads an unpacked extension only when its manifest version changes, so confirm A runs extension 1.8.0 (chrome://extensions on a normal window, or the DevTools of the bar's </> button).
  2. On A: Settings → Monitors — arrange the two monitors as on the desk and note which is main. Settings → System update → Advanced options — switch on Linked ClawBoxes (experimental) and Linked ClawBoxes use this ClawBox's monitors (experimental). Settings → Linked ClawBoxes — add B's desktop address.
  3. With the kiosk window over both monitors press Ctrl+Shift+2. Expect B's desktop in a tab, laid out per monitor of A: its shelf, chat, desktop icons, notices and toasts only on A's main monitor; each monitor with its own wallpaper; open an app on B and maximise it → it fills one monitor, not both; drag it to the other monitor and maximise/snap (half of that monitor); open a modal (e.g. Settings → System update → Force full update) → its scrim and panel centre on the main monitor.
  4. Change A's layout (Settings → Monitors on A: move a monitor or make the other one main, Apply and Keep) or plug a monitor in/out: within a few seconds B's desktop follows (a window goes with its monitor).
  5. On B (inside A's kiosk) open Settings → Monitors: A's monitors read-only with the one line, no Apply/Keep/Identify, nothing of B's own outputs.
  6. Ctrl+Shift+1 back to A: A's own desktop looks exactly as before. Open B's desktop in an ordinary browser tab: one screen, B's Settings → Monitors is B's own panel. /updating on either box: as before.
  7. Off switch: turn the second switch off on A → B's page drops back to one screen within about 3 s and its Settings → Monitors is B's own panel again (reload B's tab if it does not).

🤖 Generated with Claude Code

yalexx and others added 2 commits November 24, 2026 09:57
…sk's monitors (experimental, off by default)

A linked ClawBox's desktop shown in a tab of another box's kiosk laid itself
out from GET /setup-api/monitors of the box that serves it: the wrong box's
monitors, or available:false, so it was stretched over the kiosk's whole row
as one screen.

A second experiment, switched on in Settings -> System update -> Advanced
options (box preference ui_linked_boxes_screens, off by default, built like
ui_linked_boxes: event, extension storage, ten languages), lets the kiosk
extension (1.8.0) carry the kiosk's own monitors to the page:

- the kiosk's own desktop script reads its box's /setup-api/monitors (same
  origin, owner's session) when the worker asks;
- a page of another box asks the worker every 3 s while it is shown; the worker
  answers only a page on the origin of one of the owner's linked boxes, and
  hands over geometry only, rebuilt value by value (connector names for ids,
  never make, model or serial);
- the page reads it from <html data-clawbox-viewer-screens>, validated as
  strictly as recallMonitorStatus and more, rebuilt, and lays itself out with
  the same screensFromStatus rule; it reads its own box's monitors not at all.

Settings -> Monitors on a box shown that way draws the kiosk's monitors
read-only under one line saying they are arranged on the box that runs the
screen, instead of this box's own outputs. Off, a box's own kiosk desktop, a
desktop in an ordinary browser tab, Jetson boxes and /updating's recall are
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ing, the page's validator refuses a repeated monitor id, one flag saver

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@yalexx
yalexx deployed to e2e-pull-request November 24, 2026 08:12 — with GitHub Actions Active
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

CI Summary

✅ Tests

  • Result: passed
  • View run
  • Coverage: statements 90.56%, branches 84.3%, functions 90.12%, lines 93.15%

✅ E2E

✅ E2E Install

  • Result: success
  • Shards: core — the upgrade shard runs when a PR touches a path it depends on (e2e-install/shards.ts)
  • View run

This branch was successfully deployed

1 active deployment
e2e-pull-request — 4065c82e Deployed Nov 24, 2026 by yalexx via e2e-install (core) #5037
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant