Under --x11 with a host EWMH window manager (e.g. Openbox in Gamerig), Chandra is one top-level X11 client while other apps run directly on Xorg, so the dock only saw Chandra's Wayland windows. - compositor/x11: intern EWMH/ICCCM atoms and track _NET_CLIENT_LIST, _NET_ACTIVE_WINDOW, titles, and window states via PropertyChangeMask, filtering non-taskbar/child windows and adding focus, close, minimize, and toggle-maximize EWMH/ICCCM actions. - compositor/shell: add resolve_external_app_id (matching WM_CLASS and StartupWMClass against installed .desktop files) and publish_windows. - compositor/host: bridge ExternalWindow entries with bit-30 tagged IDs into shell.windows/win_list while keeping Wayland wm.windows and session snapshots untouched, and route activate_task / window_command actions. - compositor/app, compositor/bin, docs/x11.md: wire external window sync before X11 input handling and register ExternalWindowHandler. Verified: moon test --target native compositor/x11 compositor/shell (38/38), external_windows_test.mbt + dock_test.mbt (3/3), build-compositor-wasm.sh, and moon build --target native compositor/bin.
5.6 KiB
Running Chandra on Xorg (NVIDIA)
--x11 runs Chandra on an X server instead of on DRM/KMS. It exists for machines where the
display is NVIDIA's proprietary driver on Xorg: the driver draws the screen, Chandra is one X
client on it, and Wayland apps connect to Chandra as usual.
build/wasmhost build/compositor.wasm --socket "$XDG_RUNTIME_DIR/wayland-moon-0" --x11
just run-x11 # the same, from the checkout
Modes
| Where | What --x11 does |
|---|---|
| An X desktop with a window manager (GNOME on Xorg, KDE X11, Openbox...) | A normal, resizable window (--size WxH, default 1280x720). --fullscreen asks the window manager for a fullscreen window. |
An X server with no window manager (startx, xinit, the "Chandra (X11)" login entry, a headless NVIDIA Xorg in a container) |
Chandra covers the whole screen, takes the keyboard, and follows the screen when it is resized (xrandr, as Selkies does when the browser window changes size). |
Chandra decides by looking for an EWMH window manager on the root window
(_NET_SUPPORTING_WM_CHECK).
As your login session
just install also installs /usr/share/xsessions/chandra-x11.desktop. Pick Chandra (X11) on
the login screen (GDM, SDDM, LightDM): the display manager starts Xorg with the NVIDIA driver and
runs chandra-session --x11, which starts the compositor with --x11 --login-session (power
actions, the polkit password dialog and apps' dark/light preference, as in the DRM session).
Without a display manager, put this in ~/.xinitrc and run startx from a text console:
exec /usr/local/bin/chandra-session --x11
The log is ~/.local/state/chandra/session.log, as for the DRM session.
How it works
compositor/x11/x11.mbt speaks the X11 wire protocol itself over /tmp/.X11-unix/X<n>, like the
nested backend speaks Wayland: no libX11 or libxcb, and the same code runs in the wasm compositor
(either host) and in the native build.
- Authentication: the
MIT-MAGIC-COOKIE-1for the display from$XAUTHORITY(or~/.Xauthority); this host's entry first, then a wildcard or any other local entry. - Frames: MIT-SHM 1.2 with fd passing (
ShmAttachFd+ShmPutImage). The host's framebuffer memfd goes straight to the X server, so no pixels pass through the compositor, and the next frame waits for the server's completion event. Needs a 24-bit TrueColor visual (any NVIDIA setup at the defaultDefaultDepth 24). Without MIT-SHM it falls back to corePutImagein strips, which is slow on the wasm hosts (about 2 frames a second at 1280x800, because the pixels cross the component boundary);CHANDRA_X11_NO_SHM=1forces that path for debugging andCHANDRA_X11_DEBUG=1logs its frame times. - Keyboard: Xorg's keycodes are evdev codes + 8, the same as libinput's. The keymap sent to
Wayland clients is the X server's own (
xkbcomp -xkb $DISPLAY -), so the layout and options are whatever Xorg was configured with; aftersetxkbmapnew apps get the new one. X's auto-repeat is dropped (Wayland apps repeat keys themselves). Modifier and lock state come from X's modifier map. - Pointer: motion, buttons (left, middle, right, back, forward), wheel (buttons 4-7). The cursor comes from the X cursor font, picked by the shape Chandra wants.
- Input injection (XTest,
xdotool, Selkies, VNC servers) works, since it arrives as ordinary X events.
Tested on NVIDIA
2026-11-26 on a Vast.ai rig (GeForce GTX 1650, driver 595.91.07, the gamerig-tiny image's headless
NVIDIA Xorg on :0, depth 24, MIT-SHM): under Openbox with --fullscreen, on the whole screen
with no window manager (also after the window manager was killed and left a stale
_NET_SUPPORTING_WM_CHECK), following xrandr --output DVI-D-0 --mode 1024x768, and typing into
foot through XTest (xdotool, the way Selkies injects input). Not yet tried: a physical NVIDIA
desktop through a display manager.
Limits
- Apps don't get the NVIDIA GPU through Chandra. Chandra composes on the CPU and its Wayland
clients share buffers with
wl_shm; there is nozwp_linux_dmabuf_v1yet, so GPU-drawing apps (games, Zed, Chrome with GPU raster) fall back to software rendering (llvmpipe/lavapipe) or fail, exactly as on the DRM backend. Running on Xorg makes Chandra start on NVIDIA; it does not give its apps hardware acceleration. See docs/kiosk-gamerig.md (G4). - X11-only apps run on the X server, not in Chandra.
DISPLAYstays set, so an app that only speaks X11 (Steam, xterm) opens on Xorg directly: under an EWMH window manager it is a window beside Chandra's, and Chandra tracks_NET_CLIENT_LIST/_NET_ACTIVE_WINDOWso the panel's dock shows and switches to it; in whole-screen mode it maps on top of Chandra with no window manager to move it. Chandra has no Xwayland. - Only local displays (
:0,unix:0): no TCP displays orssh -X. - Keyboard layout groups: the group is always reported as 0, so layout switching through XKB groups (two layouts with a toggle key) shows the first layout's symbols in Wayland apps.
- One screen: Chandra covers the X screen it opened (multi-monitor setups are one big X screen under NVIDIA's TwinView/xrandr, so Chandra spans all monitors).
Isn't there a KMS path on NVIDIA now?
With the NVIDIA driver 545 or newer and nvidia-drm.modeset=1 (the default from 560 on), NVIDIA
does offer KMS and dumb buffers, which is all --drm uses (no GBM, no EGL). So on a recent
driver the regular Chandra session may work too: try just run-drm from a text console. --x11
is for older drivers, modeset=0 setups, and anywhere Xorg must stay the display server (a
streaming rig whose grabber reads the X screen).