# Chandra as the gamerig kiosk: feasibility Question (V, 2026-11-26): gamerig, the game streaming platform (), could use Chandra instead of its current display/session shell, "because it's so small". This document says what that shell does today, how Chandra fits, what is missing, and in what order to close the gaps. Numbers marked **measured** were measured; **est.** are estimates with the method given. **Revised 2026-11-26** after Chandra gained its X11 backend (`--x11`, e6be382/e184e29, [x11.md](x11.md), tested on a Vast GTX 1650 with driver 595 under gamerig-tiny's Xorg) and kiosk mode (`--kiosk`, d521d0d, [kiosk.md](kiosk.md)). The first version of this document assumed Chandra had to replace Xorg as a Wayland compositor, which needs linux-dmabuf, Xwayland and a Wayland port of Selkies; its verdict was "not yet". On Xorg none of that is needed. ## TL;DR * **gamerig has no client device.** A rig is a headless Docker container on a rented Vast.ai NVIDIA host. Games run inside it on headless NVIDIA Xorg; Selkies-GStreamer captures the X screen (`ximagesrc`), encodes it with NVENC and sends it over WebRTC to the player's browser. The "kiosk" is the in-stream home screen: Openbox, a fullscreen watcher, a WebKit2GTK window showing the library (`shell_window.py`) and a GTK taskbar. * **Chandra now fits as an X client on that Xorg.** Xorg, the NVIDIA driver, Selkies, server.py and the games stay exactly as they are. Chandra replaces the library window: one fullscreen X window with `WM_CLASS gamerig-desktop` (so Openbox's rules, Ctrl+Alt+L / Super+Space and server.py's `wmctrl -xa` find it as before), running in kiosk mode inside. * **Games keep the GPU.** They are X11 (or SDL on X11) clients of NVIDIA Xorg, started by server.py, not by Chandra, so the dmabuf problem never comes up. Steam and Proton are X11 anyway. * **Selkies keeps working unchanged**: it captures the X screen Chandra draws into (MIT-SHM), injects keyboard and mouse with XTest (Chandra reads them as ordinary X events; tested with `xdotool` on NVIDIA), and resizes with `xrandr` (Chandra follows). * **Step 1 is built**: `--kiosk CMD` (no panel, no shortcuts or desktop menus, the app fullscreen, restarted when it exits, Ctrl+Alt+Shift+Escape or `chandra-ctl kiosk unlock` for admin work), `--app-id NAME`, and `scripts/gamerig-kiosk.sh`, which swaps gamerig's library window for Chandra on a running rig. Tested locally under Openbox on Xvfb (fullscreen, `WM_CLASS`, XTest typing, restart). **Not yet tested on a rig** (see §6). * **The size win comes in steps 2 and 3**, not step 1. Chandra is **12 MiB gzip measured** (the whole package: host with wasmtime linked in, compositor, modules, fonts, the few libs a tiny image lacks). Step 1 adds it next to WebKit. Step 2 (a native launcher module) removes the WebKit kiosk (≈ 67 MiB est.); step 3 (Chandra as the X window manager) removes Openbox (≈ 52 MiB est.). Net ≈ **−105 MiB** of the ≈ 450 MiB `gamerig-tiny` image (est.). * **Recommendation: go**, with two caveats: confirm step 1 on a rig first, and the real work is the launcher module (step 2), since Chandra can't render the HTML/Rabbita library itself. ## 1. What gamerig's session shell does today Read from `docker/onstart.sh`, `docker/desktop/*.py`, `desktop/ui/`, `docker/Dockerfile.tiny` and `docs/tiny-image/DESIGN.md` in the gamerig repo. | Piece | Today | With Chandra | | --- | --- | --- | | Display server | headless **NVIDIA Xorg**, 4-variant xorg.conf retry ladder, `GAMERIG_FATAL=` codes | unchanged | | Window manager | **Openbox** with a generated `rc.xml`: every normal window borderless fullscreen, `gamerig-desktop` too; Ctrl+Alt+L / Super+Space run `wmctrl -xa gamerig-desktop`; Alt+Tab | step 1: unchanged. Step 3: Chandra manages X windows itself | | Fullscreen watcher | python-xlib loop keeping games snapped to the screen after resizes | step 3: Chandra | | Home screen | `shell_window.py`: GTK3 + **WebKit2GTK** fullscreen X window (`gamerig-desktop`), restarted by a bash supervisor | step 1: Chandra's X window (`--app-id gamerig-desktop`), kiosk mode; inside it, the same `shell_window.py` as a Wayland client. Step 2: a native module | | Library UI | `desktop/ui`: MoonBit + Rabbita (calm) web app: categories, search, app grid, Launch / Big Picture / Focus / Logs / Stop, Add App, running apps, rig status | step 2: ported to a Chandra desktop module | | Library daemon | `server.py` on `127.0.0.1:8091`: catalog, launches apps as X11 clients, focus/stop via `wmctrl`/`xdotool` | unchanged | | Taskbar | `taskbar.py` (GTK dock bar via `wmctrl -l`) | unchanged; later Chandra's own task strip | | Streaming, input, resize | Selkies 1.6.2: `ximagesrc`, XTest, `xrandr`; gamepads as uinput devices read by games | unchanged | | Audio | PipeWire + pipewire-pulse | unchanged | | Auth, updates, networking | on the control plane / in the image / Docker | nothing for Chandra to do | ## 2. How the pieces fit on one Xorg ``` NVIDIA Xorg :0 ─────────────── Selkies (ximagesrc → NVENC → WebRTC; XTest input; xrandr) ├─ Openbox (step 3: Chandra) ├─ Chandra --x11 --fullscreen --app-id gamerig-desktop --kiosk "" │ └─ Wayland clients on Chandra's socket: the library app (WebKit today, a module later) ├─ games, Steam, Proton, xterm … X11 clients started by server.py, full NVIDIA GLX/Vulkan └─ taskbar.py ``` * **Back to the library**: Ctrl+Alt+L is an Openbox binding (`wmctrl -xa gamerig-desktop`), so it raises Chandra's window over the game; server.py's "focus library" does the same. Nothing changes. * **Launching a game** from the library calls server.py, which starts it on Xorg; Openbox maps it fullscreen above Chandra. Chandra keeps its last frame and goes idle (it only draws when its content changes). * **Environment**: Chandra starts its kiosk app with `WAYLAND_DISPLAY` set and `DISPLAY` unset. Games must not inherit that: they are server.py's children, so they don't, but an SDL3 game started from inside Chandra would pick Wayland and render on the CPU. Keep game launches on server.py. * **Clipboard**: Selkies syncs the X clipboard. Apps inside Chandra use the Wayland clipboard, and Chandra doesn't bridge the two yet (gap G5). Games are on X, so this only affects the library app. ## 3. Gap list | # | Gap | Effort | Risk | Status | | --- | --- | --- | --- | --- | | G1 | Kiosk profile: no panel, shortcuts off, desktop menus off, focused window fullscreen, app restarted with backoff, admin escape, `chandra-ctl kiosk`; `--app-id` for the X window's class; `scripts/gamerig-kiosk.sh` | 1 day | low | **done** (d521d0d), rig test pending | | G2 | **Native launcher module**: the calm library as a Chandra desktop module (desktop modules exist since 0f71779): grid, categories, search, running apps, rig status, logs, add app. Needs a capability for modules to call server.py's HTTP API (or the daemon's catalog/launch logic as a host capability) | 1-2 weeks | medium (UI parity; no HTML/CSS engine, so it is a re-implementation sharing calm's tokens) | to do; removes WebKit (≈ 67 MiB) | | G3 | **Chandra as the X11 window manager** (replaces Openbox and the fullscreen watcher): `SubstructureRedirect` on the root, map games fullscreen and borderless, leave dialogs (Steam login, file pickers) floating, focus, stacking, `_NET_ACTIVE_WINDOW` / `_NET_CLIENT_LIST` so `wmctrl`/`xdotool` keep working, follow `xrandr`, Ctrl+Alt+L / Super+Space / Alt+Tab across X and Wayland windows. Chandra already speaks the X11 protocol in MoonBit (`compositor/x11`); this is gamerig's own M3 "MoonBit X11 WM" | 1-2 weeks | medium (Steam's odd windows) | to do; removes Openbox (≈ 52 MiB) | | G4 | Gamepad navigation for modules: read the joystick evdev devices Selkies creates (libinput ignores pads; on `--x11` there is no libinput at all), a WIT gamepad event, focus movement in the launcher | 2-4 days | low | to do | | G5 | Clipboard bridge between X (Selkies) and Chandra's Wayland clients | 1-2 days | low | to do, only for apps inside Chandra | | G6 | `onstart.sh` integration: `GAMERIG_SHELL=chandra` runs Chandra instead of `shell_window.py`, same supervisor and health check (`GAMERIG_DESKTOP_EMPTY`), Chandra in the tiny image as its own small layer | 1 day | low | to do (gamerig repo) | | — | linux-dmabuf, Xwayland, a Wayland Selkies, encoder frame export | — | — | **not needed** on this path | ## 4. Size | Change to `gamerig-tiny` | est. MiB gzip | | --- | ---: | | + Chandra package (wasmhost with wasmtime, compositor.wasm, modules, fonts, libinput/libseat/libxkbcommon/libdrm and friends) | **+12 (measured)** | | − WebKit2GTK kiosk + GTK3 for the window (after G2) | −67 | | − Openbox chain (imlib2 → libspectre → libgs10 → fonts) and the python-xlib watcher (after G3) | −53 | | − `taskbar.py`'s GTK use (if Chandra draws the task strip) | small, shares GTK with the above | | **Net after G2 + G3** | **≈ −105** | The fonts (4.7 MB raw) are a third of Chandra's package; subsetting them is an easy later win. Xorg itself stays (≈ 50 MiB est.); replacing it is the Wayland route below and isn't worth it now. ## 5. Staged plan 1. **Stage 1 (built): Chandra as the library window.** `scripts/gamerig-kiosk.sh` on a running rig, or G6 in onstart. Same library (WebKit inside Chandra), same everything else. Proves the X path on NVIDIA: capture, XTest input, resize, Ctrl+Alt+L, game on top, back to the library. 2. **Stage 2: native launcher module** (G2 + G4). Drops WebKit from the image. The library becomes gamepad-navigable inside the stream. 3. **Stage 3: Chandra as the window manager** (G3). Drops Openbox and the watcher; the Alt+Tab and "back to library" logic moves into one place. 4. **Stage 4: image.** Chandra as its own layer in `Dockerfile.tiny`, WebKit and Openbox removed, `GAMERIG_SHELL=chandra` the default after an A/B on real rigs. ## 6. Rig test status The local test (Openbox + Xvfb, 1280x720) passed: Chandra's window is `gamerig-desktop`, 1280x720+0+0 under Openbox's fullscreen rule; the kiosk app (foot) fills it with no panel; the Super tap does nothing; `xdotool type` lands in the app; killing the app brings it back. Still to run on a Vast rig with gamerig-tiny: `scripts/gamerig-kiosk.sh` replacing the library window, WebKit (`shell_window.py`) as a Wayland client on wl_shm, launching `vkcube`/Astra through server.py and returning with Ctrl+Alt+L, Selkies resize. The earlier X11 test on the same host class already covered MIT-SHM, XTest typing and `xrandr` on NVIDIA. ## 7. The Wayland route, for the record Replacing Xorg with Chandra as a Wayland compositor (the first version of this document) needs `zwp_linux_dmabuf_v1` with an NVIDIA import path (games can't present to `wl_shm` at GPU speed), Xwayland + an XWM (Steam, Proton), a Wayland capture/input/resize path for Selkies, and encoder frame pacing: 2-3 months, with the riskiest part (NVIDIA dmabuf/GBM inside Vast containers) unverifiable without rentals. It would save Xorg's ≈ 50 MiB more. Not worth it while the X path works. ## 8. Reading B: a physical kiosk box A mini PC booting into Chandra (`--drm`, or `--x11` on NVIDIA) with `--kiosk` running a browser on gamerig's play page also works today: the browser decodes the stream (software H.264 is fine at 1080p60), reads gamepads itself, and the kiosk keeps it fullscreen and restarted.