Gamerig Library: gamerig's game library as a Chandra desktop module
CI / test (push) Successful in 2m25s
CI / test (push) Successful in 2m25s
- New desktop module gamerig-library (components/gamerig-library, logic in lib/gamelib): the layout of gamerig's web library (desktop/ui) in draw ops. Top bar with the Gamerig mark, app count and search; sidebar with categories and counts, running apps (switch to, stop) and rig status (GPU, display, audio); card grid with featured games two columns wide, icon tiles, category and status badges, description, install hint, Launch / Big Picture / Switch to / Stop. Typing filters, arrows + Enter launch, the wheel scrolls. Colours: follow desktop, dark, light. - New game-library capability: tables 26-28 (status, games, launch modes), request 45, in the wasmer/wasmtime stub, the MoonBit wasmhost and the Rust host-wasm. - compositor/shell/gamelib.mbt polls GET $GAMERIG_DESKTOP_API/api/state (default http://127.0.0.1:8091) every 2 s with curl on a socket and POSTs launch/stop/focus; a file:// base reads a state file (tests). - --desktop NAME picks what fills the desktop at start. scripts/gamerig-kiosk.sh now runs a hybrid kiosk with the library as the desktop (CHANDRA_KIOSK_MODE=strict for the old one). - Tests: lib/gamelib, compositor/host/gamelib_test.mbt, a host-wasm test; docs/gamerig-library.md with a screenshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hgvjzw8hHirxRsXSsE
This commit is contained in:
57 files changed
+3551
-29
No files matched your search
@@ -5,7 +5,7 @@ instead of a box in the panel. Use it for interactive desktops (an icon launcher
|
||||
wallpaper, a game, a dashboard). It runs in the same sandbox as a panel module, draws with the
|
||||
same draw ops and asks for the same capabilities; only the way the shell drives it differs.
|
||||
|
||||
Two samples ship with Chandra:
|
||||
Three ship with Chandra:
|
||||
|
||||
* **Icon Desktop** (`components/icon-desktop`, logic in `lib/icondesk`): a grid of app icons on
|
||||
the wallpaper. Click to launch, drag to move (dropping on another icon swaps them), arrow keys
|
||||
@@ -16,8 +16,14 @@ Two samples ship with Chandra:
|
||||
wheel changes speed. Module settings: speed, density, and Moving or Still (Still draws one
|
||||
frame and then costs nothing).
|
||||
|
||||
* **Gamerig Library** (`components/gamerig-library`, logic in `lib/gamelib`): gamerig's game
|
||||
library (categories, search, cards with Launch / Big Picture / Stop, running apps, rig status),
|
||||
fed by gamerig's library daemon through the `game-library` capability. See
|
||||
[gamerig-library.md](gamerig-library.md).
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Choosing what fills the desktop
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# Gamerig Library desktop module
|
||||
|
||||
The Gamerig Library is gamerig's library window (the WebKit page in `desktop/ui`, served by
|
||||
`server.py`) rebuilt as a Chandra desktop module: the same layout, colours and actions, drawn with
|
||||
Chandra's draw ops, with no browser engine. On a rig it is the desktop of a hybrid kiosk: the
|
||||
panel, the dock and Alt+Tab work, the library fills the desktop, and leaving the session is
|
||||
locked.
|
||||
|
||||

|
||||
|
||||
```
|
||||
GAMERIG_DESKTOP_API=http://127.0.0.1:8091 \
|
||||
build/wasmhost build/compositor.wasm --x11 --fullscreen --app-id gamerig-desktop \
|
||||
--kiosk-hybrid --desktop gamerig-library
|
||||
```
|
||||
|
||||
or pick **Gamerig Library** in Settings > Desktop.
|
||||
|
||||
## What it shows
|
||||
|
||||
* **Top bar:** the Gamerig mark, "Library" with the app count, the Alt Tab hint and the search
|
||||
box (typing filters while the desktop has the keyboard; every word must match the name, id,
|
||||
category or description).
|
||||
* **Sidebar:** Library categories (All, Games, Launchers, Tools, Running) with their counts;
|
||||
Running Apps (click one to bring its window forward, × stops it); Rig Status at the bottom
|
||||
(GPU, display, audio with its dot; an orange dot while the daemon can't be reached).
|
||||
* **Cards:** featured games two columns wide; icon tile (gamerig's lucide icon names: Play,
|
||||
Sparkles, Folder, Star, Square, Terminal, Settings, ExternalLink), name, category and status
|
||||
badges (Ready, Running, Not installed), description, the install hint for what isn't installed,
|
||||
and the buttons: **Launch** (gold when it can start), extra modes such as **Big Picture**, and
|
||||
**Switch to** / **Stop** while it runs. What the daemon refuses ("lutris is not installed")
|
||||
shows under the title for a few seconds.
|
||||
* Keyboard: arrows move the selection, Enter launches it (or switches to it), Backspace and
|
||||
Escape edit the search; the wheel scrolls the grid.
|
||||
* Module settings (right-click the desktop): Colours, *Follow desktop* (gamerig dark or light
|
||||
after the desktop theme), *Dark* or *Light*.
|
||||
|
||||
Not there yet: the Add App dialog and the per-app logs view (both are in the web library), and
|
||||
gamepad navigation (gap G4 in [kiosk-gamerig.md](kiosk-gamerig.md)).
|
||||
|
||||
## How it gets its data
|
||||
|
||||
The module can't reach the network. The shell does it for it, through the `game-library`
|
||||
capability (`wit/capabilities.wit`):
|
||||
|
||||
* `compositor/shell/gamelib.mbt` polls `GET <base>/api/state` every 2 s while a module with the
|
||||
capability is loaded (and 250 ms after an action), with curl on a socket (`spawn_socket`), so
|
||||
the compositor never waits. `<base>` is `GAMERIG_DESKTOP_API`, default
|
||||
`http://127.0.0.1:8091`. A `file://` base reads a state file instead (tests, demos) and only
|
||||
records the actions.
|
||||
* The JSON is parsed by `lib/gamelib` (`parse_state`, the same rules as gamerig's
|
||||
`desktop/ui/library`) and published as host tables 26 (status), 27 (games) and 28 (extra
|
||||
launch modes).
|
||||
* `launch(game, mode)`, `stop`, `focus` become request 45 and then
|
||||
`POST <base>/api/apps/<id>/launch|stop|focus` (`{"mode": ...}` for launch). Games start on the
|
||||
rig's X server through server.py, exactly as from the web library, and Openbox stacks them over
|
||||
Chandra's window.
|
||||
|
||||
Served by every host: the wasmer/wasmtime stub (`compositor/wasm/wasm_stub.c`), the MoonBit
|
||||
wasmhost and the Rust `host-wasm`.
|
||||
|
||||
Code: `components/gamerig-library` (bindings and a thin stub), `lib/gamelib` (model, JSON,
|
||||
layout, drawing, input; tests in `lib/gamelib/gamelib_test.mbt`), `compositor/shell/gamelib.mbt`
|
||||
(the poller), host tests in `compositor/host/gamelib_test.mbt`.
|
||||
@@ -86,7 +86,7 @@ NVIDIA Xorg :0 ─────────────── Selkies (ximagesrc
|
||||
| # | 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) |
|
||||
| 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) | **library done**: `gamerig-library` desktop module + `game-library` capability (the shell polls server.py), [gamerig-library.md](gamerig-library.md); Add App and logs still 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 |
|
||||
@@ -111,7 +111,9 @@ Xorg itself stays (≈ 50 MiB est.); replacing it is the Wayland route below and
|
||||
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
|
||||
2. **Stage 2: native launcher module** (G2 + G4). Built as a hybrid kiosk: `gamerig-kiosk.sh`
|
||||
now runs `--kiosk-hybrid --desktop gamerig-library` (panel, dock and Alt+Tab work; Log out and
|
||||
power are locked), so the library needs no WebKit. 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.
|
||||
|
||||
+6
-1
@@ -30,9 +30,14 @@ are refused with a notice. `CMD`, if given, is started and restarted as above (w
|
||||
all is left).
|
||||
|
||||
```
|
||||
build/wasmhost build/compositor.wasm --x11 --fullscreen --app-id gamerig-desktop --kiosk-hybrid
|
||||
build/wasmhost build/compositor.wasm --x11 --fullscreen --app-id gamerig-desktop --kiosk-hybrid \
|
||||
--desktop gamerig-library
|
||||
```
|
||||
|
||||
`--desktop NAME` (any mode) picks what fills the desktop at start, as Settings > Desktop does: a
|
||||
desktop module's id, `wallpaper` or `clock-card`. On a rig that is the
|
||||
[Gamerig Library](gamerig-library.md).
|
||||
|
||||
**Admin escape:** Ctrl+Alt+Shift+Escape unlocks the kiosk (panel, shortcuts and menus come back,
|
||||
windows leave fullscreen) and locks it again. From a script: `chandra-ctl kiosk unlock`,
|
||||
`chandra-ctl kiosk lock`, `chandra-ctl kiosk status`.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
Reference in new issue
Block a user