Gamerig Library: gamerig's game library as a Chandra desktop module
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:
Claude committed 2026-11-26 02:57:07 +00:00
1 parent fa932f9ac0
commit f556df2f4b
57 files changed
+3551 -29

No files matched your search

+24 -10
View File
@@ -8,9 +8,11 @@
# * Chandra is one X client: a fullscreen window under Openbox whose WM_CLASS is gamerig-desktop,
# so gamerig's Openbox rules, Ctrl+Alt+L / Super+Space ("back to the library", wmctrl -xa) and
# server.py's focus calls find it exactly as they found the old window.
# * Inside it, Chandra runs in kiosk mode: no panel, no shortcuts, the library app fullscreen and
# restarted when it exits. Until there is a native launcher module the library app is the same
# shell_window.py, now a Wayland client of Chandra (GTK + WebKit on wl_shm).
# * Inside it, Chandra runs as a hybrid kiosk (the default, CHANDRA_KIOSK_MODE=hybrid): panel,
# dock and Alt+Tab work, the desktop is the Gamerig Library module (docs/gamerig-library.md),
# which reads and drives server.py through the shell; Log out and power are locked. No WebKit.
# CHANDRA_KIOSK_MODE=strict runs the old single-app kiosk instead: no panel, no shortcuts, the
# library app (shell_window.py as a Wayland client of Chandra) fullscreen and restarted.
# * Games and Steam don't go through Chandra: server.py starts them on Xorg with the NVIDIA
# driver, Openbox stacks them above Chandra, Selkies captures and injects input (XTest) as before.
#
@@ -20,13 +22,14 @@
#
# Environment: CHANDRA_DIR (default /opt/chandra: wasmhost, compositor.wasm, components/, wit/,
# config/, assets/, lib/), GAMERIG_DESKTOP_DIR (default /opt/gamerig-desktop), GAMERIG_DESKTOP_PORT
# (8091), DISPLAY (default: the first X socket), CHANDRA_KIOSK_APP (the app run in the kiosk;
# default gamerig's library window).
# (8091), DISPLAY (default: the first X socket), CHANDRA_KIOSK_MODE (hybrid or strict),
# CHANDRA_KIOSK_APP (strict: the app run in the kiosk; default gamerig's library window).
set -u
CHANDRA_DIR=${CHANDRA_DIR:-/opt/chandra}
GAMERIG_DESKTOP_DIR=${GAMERIG_DESKTOP_DIR:-/opt/gamerig-desktop}
PORT=${GAMERIG_DESKTOP_PORT:-8091}
MODE=${CHANDRA_KIOSK_MODE:-hybrid}
LOG=${CHANDRA_KIOSK_LOG:-/var/log/chandra-kiosk.log}
if [ -z "${DISPLAY:-}" ]; then
@@ -44,8 +47,13 @@ mkdir -p "$XDG_RUNTIME_DIR" && chmod 700 "$XDG_RUNTIME_DIR"
# so GTK picks Wayland. WebKit gets no DMA-BUF renderer and no sandbox in a container (as onstart.sh).
APP=${CHANDRA_KIOSK_APP:-"env WEBKIT_DISABLE_DMABUF_RENDERER=1 WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1 NO_AT_BRIDGE=1 python3 $GAMERIG_DESKTOP_DIR/shell_window.py --url http://127.0.0.1:$PORT/"}
echo "chandra: $CHANDRA_DIR DISPLAY=$DISPLAY XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"
echo "kiosk app: $APP"
export GAMERIG_DESKTOP_API=${GAMERIG_DESKTOP_API:-http://127.0.0.1:$PORT}
case "$MODE" in
strict) KIOSK_ARGS="--kiosk"; echo "kiosk app: $APP" ;;
*) MODE=hybrid; KIOSK_ARGS="--kiosk-hybrid --desktop gamerig-library"; APP="" ;;
esac
echo "chandra: $CHANDRA_DIR DISPLAY=$DISPLAY XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR mode=$MODE"
echo "library daemon: $GAMERIG_DESKTOP_API"
[ "${1:-}" = "--check" ] && exit 0
if [ ! -x "$CHANDRA_DIR/wasmhost" ] || [ ! -f "$CHANDRA_DIR/compositor.wasm" ]; then
@@ -73,9 +81,15 @@ export LD_LIBRARY_PATH="$CHANDRA_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
delay=1
while true; do
start=$(date +%s)
echo "$(date -u +%FT%TZ) starting chandra (kiosk)" >>"$LOG"
./wasmhost compositor.wasm --x11 --fullscreen --app-id gamerig-desktop \
--socket "$XDG_RUNTIME_DIR/wayland-chandra" --kiosk "$APP" >>"$LOG" 2>&1
echo "$(date -u +%FT%TZ) starting chandra (kiosk, $MODE)" >>"$LOG"
if [ "$MODE" = strict ]; then
./wasmhost compositor.wasm --x11 --fullscreen --app-id gamerig-desktop \
--socket "$XDG_RUNTIME_DIR/wayland-chandra" --kiosk "$APP" >>"$LOG" 2>&1
else
# shellcheck disable=SC2086
./wasmhost compositor.wasm --x11 --fullscreen --app-id gamerig-desktop \
--socket "$XDG_RUNTIME_DIR/wayland-chandra" $KIOSK_ARGS >>"$LOG" 2>&1
fi
rc=$?
[ $(( $(date +%s) - start )) -ge 30 ] && delay=1
echo "$(date -u +%FT%TZ) chandra exited ($rc); again in ${delay}s" >>"$LOG"