Files
chandra/docs/gamerig-library.md
T
Claude f556df2f4b
CI / test (push) Successful in 2m25s
Gamerig Library: gamerig's game library as a Chandra desktop module
- 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
2026-11-26 02:57:07 +00:00

65 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 Library](screenshots/desktop-gamerig-library.png)
```
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`.