CI / test (push) Successful in 2m32s
The grid picks the roomiest card density that fits (fewer description and hint lines, narrower cards, then name and buttons only) before it would scroll. The module now draws over the desktop wallpaper with glassy panels and cards; Background setting Wallpaper (default) or Solid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hgvjzw8hHirxRsXSsE
69 lines
3.8 KiB
Markdown
69 lines
3.8 KiB
Markdown
# 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.
|
||
* It fits the screen: when the cards don't fit, they get narrower and say less (fewer
|
||
description and hint lines, then name and buttons only) before the grid would scroll.
|
||
* It is the desktop's "wallpaper": panels and cards are glassy and the desktop wallpaper shows
|
||
through. Module settings (right-click the desktop): Background, *Wallpaper* or *Solid*
|
||
(gamerig's own background colour); 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`.
|