diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-18 16:34:31 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-18 16:34:31 +0100 |
| commit | b5f0a9e930146465ff5c97dc47f894ad1324b605 (patch) | |
| tree | 10b1887ddb55be3b2586fe3f220794da740bf3b4 /docs/superpowers/specs | |
| parent | e4d978965e1249fa61da8e42f679fb85db872e57 (diff) | |
| download | deck-it-b5f0a9e930146465ff5c97dc47f894ad1324b605.tar.gz deck-it-b5f0a9e930146465ff5c97dc47f894ad1324b605.zip | |
docs: spec for games on the now playing card
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/superpowers/specs')
| -rw-r--r-- | docs/superpowers/specs/2026-11-18-now-playing-games-design.md | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/docs/superpowers/specs/2026-11-18-now-playing-games-design.md b/docs/superpowers/specs/2026-11-18-now-playing-games-design.md new file mode 100644 index 0000000..db41b21 --- /dev/null +++ b/docs/superpowers/specs/2026-11-18-now-playing-games-design.md @@ -0,0 +1,78 @@ +# Now playing: games on the Dashboard's music card + +## Goal + +While a game runs, on the PC or on the Xbox, the Dashboard's music card shows +the game instead of the track. When no game runs it is the music card as +before. + +## Sources + +- **PC** (new module `deckit/modules/games.py`): Steam, PCSX2 and DuckStation. +- **Xbox**: the existing `xbox` module's `playing`, `session` and `titles`. + +## PC detection + +`hyprctl clients -j` on each state read (the card polls every 5s). + +- Class `steam_app_<id>`: Steam game `<id>`. +- Class `pcsx2-qt`: PS2. Class `duckstation-qt`: PS1. Only when the window + title is not the bare emulator name (`PCSX2`, `DuckStation`), which is the + idle game list. + +First match wins; one game at a time. + +## PC game data + +Steam (root `~/.local/share/Steam`): + +- name: `steamapps/appmanifest_<id>.acf` `name`, in each library listed by + `steamapps/libraryfolders.vdf`; fallback the window title. +- cover: `appcache/librarycache/<id>/library_600x900.jpg`. +- total minutes: `userdata/*/config/localconfig.vdf`, the app's `Playtime`. + +Emulators (PCSX2 `~/.config/PCSX2`, DuckStation `~/.local/share/duckstation`): + +- name: the window title. +- serial: the `cache/gamelist.cache` entry whose title equals the window + title (the cache stores path, serial, title as strings in a row). +- cover: `covers/<serial>.jpg` (or `.png`). +- total minutes: `playtime.dat` line `<serial> <seconds> <last played>` + (PCSX2 keeps it in `inis/playtime.dat`). + +Any of these missing or unparsable leaves that field empty. No error card. + +## State + +`/api/games`: + + {"playing": null} + {"playing": {"platform": "steam|ps1|ps2", "name": "...", "cover": "/api/games/image/<key>"|null, + "minutes": <total before this session>|null, "session": <unix start>}} + +`session` is the time deck-it first saw the game (same rule as Xbox). A cover +is served at `/api/games/image/<key>` for the current game only, so the +tablet never names a path. + +## Card + +`static/modules/music.js` `update(st, el)` keeps the music view. The +dashboard passes it a game when one runs, picked in this order: PC game, Xbox +`playing`. For Xbox: name from `playing.name`, cover and minutes from the +`titles` entry with the same id, `session` from the state. + +Game view: cover, name, platform badge (Steam, PS1, PS2, Xbox), session time +ticking client side, total = minutes + session. Music controls hidden. + +The dashboard polls `games` every 5s and `xbox` every 30s, each only when its +module is enabled. + +## Out of scope + +Achievements, FPS/GPU stats, launchers other than Steam, PCSX2, DuckStation. + +## Tests + +`tests/test_games.py`: fake `run` for hyprctl and a temp tree with an acf, +libraryfolders.vdf, localconfig.vdf, gamelist.cache bytes and playtime.dat. +`node --check` on changed JS. |
