Skip to content

kde-vnc-cdp

Recipe card from the charly-selkies plugin (Images — the deployable catalog).

kde-vnc-cdp — the KDE desktop over VNC, with the full CDP surface

Section titled “kde-vnc-cdp — the KDE desktop over VNC, with the full CDP surface”

pod-kde-vnc’s desktop, unchanged, plus the browser automation every other streaming pod has:

layer provided by detail
base image podcdi.pod-cdi CachyOS; the GPU driver is injected from the host through CDI
desktop pod-kde-vnc → kde-vnc-session headless sway → wayvnc :5900; nested KWin + plasmashell on wayland-kde; the ambient session env
browser pod-chrome-cdp → chrome-cdp chrome-wrapper (CDP on 127.0.0.1:9223, Windows UA, chrome-windows extension), cdp-proxy (0.0.0.0:9222), browser-open ($BROWSER), chrome-restart, BROWSER_CDP_URL
MCP pod-chrome-devtools-mcp (composed by chrome-cdp) chrome-devtools-mcp over Streamable HTTP on 9224
this repo kde-vnc-cdp-session declares Chrome as a SUPERVISED program on the Plasma socket

Ports are inherited from the candies: 5900 (VNC), 9222 (CDP), 9224 (MCP). The image declares none of its own.

Why Chrome is a PLASMA window and supervised

Section titled “Why Chrome is a PLASMA window and supervised”
  • On wayland-kde, not wayland-0. sway’s wayland-0 is the compositor BEHIND the fullscreen KWin window: a browser there is invisible in the stream. Chrome must join KWin’s socket so it is a Plasma window the VNC user sees and can take over.
  • Supervised. The chrome service execs chrome-wrapper with wait_for: /tmp/wayland-kde, so KWin binds its socket before the browser starts, a slow session fails the SERVICE with a reason, and an exit restarts the browser (start_sec: 5 resets the retry budget past the startup transient). A compositor-driven launch cannot do any of that, and a hand launch would put a SECOND browser on the same --user-data-dir.
  • Maximized by the wrapper (--start-maximized), asserted on BOTH sides: the browser’s own window.outerWidth/outerHeight against screen.avail* (MAXOK), and the compositor’s window geometry via kdotool. The flag alone proves nothing on Wayland — xdg-shell.set_maximized is a request, and KWin’s placement runs after it.
  • Every cdp: method against the browser: status, list, open, close, url, text, html, eval, axtree, wait, coords, raw, screenshot, click, type. Use context: [runtime] in a bed; deploy is not a check mode and a deploy-scoped check step is skipped.
  • cdp: screenshot works here, with one platform quirk worth knowing. On this GPU Wayland Chrome the SURFACE capture (fromSurface:true) never returns, so the plugin bounds that attempt and falls back to the renderer-VIEW capture, which returns a real PNG of the page — the bed reads its text back with host OCR. Do not assert artifact_not_uniform on a page capture: it samples 100 pixels at a fixed stride, and a mostly-white page is white at every sample point while the capture is perfectly good (that misreading is what opencharly/plugin-cdp#14 was, and it is closed as not-a-defect). Assert CONTENT — OCR the artifact — or assert bytes/dimensions only.
  • cdp: spa-* does NOT apply. Those methods drive a Selkies SPA page (canvas + overlay input); this pod streams VNC. For desktop-level pointer work use cdp: coords for the LOCATE half and vnc: click / vnc: type for the DELIVER half.
  • wl: is window management only on KWin. plugin-wl routes KWin’s toplevel/focus/close/fullscreen/minimize/geometry through kdotool and fail-fasts the wlroots paths: no pointer, no keyboard, no clipboard, no resolution. Pointer and keyboard input in this pod come from vnc:.
  • cdp: coords’ Sway: line names the nested KWin window, not Chrome — the point is over the compositor’s window, which is what the sway tree can see. The Desktop: line is the one to hand to vnc: click; the Viewport: line is browser-relative.
  • The ambient session env is the image’s DEFAULT, not a guarantee. WAYLAND_DISPLAY=wayland-kde and KDE_SESSION_VERSION=6 come from the composed desktop candy, so anything started inside lands in Plasma by default. A CHECK STEP must still name its display: the runner forwards the operator’s environment into the container (measured), and the supervised chrome service states its own WAYLAND_DISPLAY for the same reason.

Needs a host with a GPU exposed through CDI (the CPU-only sibling to run instead is check-sway-browser-vnc-pod, which covers the helpers’ unsupervised branch).

what verb
six services RUNNING, Chrome stable ≥25s command: supervisorctl status
KWin fullscreen; hardware OpenGL command: swaymsg -t get_tree, KWin supportInformation
Chrome is a KWin client, maximized (both sides) command: kdotool search/getwindowgeometry, cdp: eval MAXOK
every cdp: method cdp: steps (status…close)
the VNC frame SHOWS the page vnc: screenshot (captures the desktop) + a HOST-side command: running tesseract over that PNG — the vnc: verb does not carry artifact_contains_text (measured)
VNC DRIVES the page vnc: click at the maximized window’s centre + vnc: type into a CDP-focused field, read back by cdp: eval
$BROWSER, chrome-restart command: browser-open …, chrome-restart, then cdp: status
the MCP catalog mcp: ping, mcp: list-tools
a REAL external page (CDP surface only) cdp: open https://example.com/ → tab: 1 is the page (the close-others step asserts it) → title/text needles from its live copy → cdp: screenshot + host OCR. Its VNC leg is deliberately OUT: measured, the streamed frame stayed stale for 3m20s after the restart cycle (opencharly/pod-kde-vnc-cdp#4), so only the pod’s OWN marker page is asserted over the stream

Host prerequisite for the OCR steps: tesseract with English data. It runs on the HOST, not in the image, driven from a host-side command: step because vnc: has no artifact_contains_text; the frame is extracted from the recording (the last complete JPEG) and OCR’d at its native size — one marker word in large type reads directly, measured (bed-vnc-shows-page: 2 attempts, 10.2 s).

The marker the frame carries is a SINGLE WORD (CHARLYCDP): a hyphenated token is the one thing OCR reliably mangles. Prove the assertion can fail (a word that is not on screen must go RED) before trusting a green one.

The external-page steps need outbound HTTPS from the host’s pod network, and they assert the live copy of https://example.com/ — so a proxy, a captive portal, or a cached page fails them by design, visibly, naming egress rather than the pod’s internals.

A single capture can carry a STALE frame — assert over the RECORDING

Section titled “A single capture can carry a STALE frame — assert over the RECORDING”

Measured on this pod: after the supervised browser’s stop → browser-open → chrome-restart cycle, presentation can stall. KWin still reports the window’s title, geometry, desktop and activation; CDP still answers title, text and the target list; and a one-shot vnc: screenshot returns a complete, coherent, but old frame — a New Tab page from before the navigation. Six rounds of window/tab/activation assertions passed while the screen showed that old frame.

probe stalled healthy
Page.captureScreenshot fromSurface:true hangs hangs (a platform quirk)
Page.captureScreenshot fromSurface:false hangs answers instantly
first vnc: screenshot after the stall old frame current frame
the next vnc: screenshot current frame current frame

It is racy: the same sequence left the renderer healthy on one attempt, and one bed run kept the frame stale for 3m20s. So a frame assertion must not pin one instant:

  1. Assert over the pod’s own VNC session recorder — vnc: {method: session, action: start, session_id: …, fps: 2} → an eventually: host-side OCR that reads the LAST COMPLETE FRAME of the growing /tmp/charly-session/<id>/frames.mjpeg → action: stop. The engine re-reads as the recording grows, which is what a viewer’s stream actually is.
  2. Drive first, record after. Measured: with the recorder running before the VNC click/typing steps, typing stopped reaching the page. Put the recorder after the driving steps.
  3. Do not “fix” the stall by moving the window. Measured: un-maximize + re-maximize unsticks the renderer but rewrites Chrome’s normal bounds to 913x1034 (the page slides out from under a desktop-centre click), minimize/restore does not unstick at all, and a no-op windowmove can cause the stall. The underlying defect is filed as opencharly/pod-kde-vnc-cdp#4.
  4. The session also LOCKS itself after ~4 minutes idle and the greeter covers everything (opencharly/pod-kde-nested#6) — assert org.freedesktop.ScreenSaver.GetActive is false.

The pod-to-pod cross-deployment CDP probe (check-cross-kde-cdp-pod)

Section titled “The pod-to-pod cross-deployment CDP probe (check-cross-kde-cdp-pod)”

This repo also carries the org’s ONLY witness of pod→pod CDP rendering, rebuilt on CachyOS+KDE after its Fedora predecessor was retired (opencharly/distro-fedora#138, #140):

  • The web SUBJECT is the bed root — the kde-web-subject image, a plain CachyOS base (cachyos.cachyos, NOT the GPU pod base) composing pod-web-layer’s fixture: nginx serving charly-fixture-web-content-marker on 8080.
  • The KDE pod is a SIBLING DRIVER member (desktop: under the bed). Its cdp: steps run on that member’s venue and navigate to http://${HOST:check-cross-kde-cdp-pod}:8080 — the SUBJECT’s container name on the shared charly net, not a host port, so no Chrome is baked into the subject and nothing goes through the host loopback.
  • A vnc: screenshot + OCR step then proves the cross-pod page is what the streamed user SEES.

Needs a GPU host for the DRIVER member only. pod-web-layer needed a distro.arch section for the fixture to compose on CachyOS at all.