# 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_`: Steam game ``. - 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_.acf` `name`, in each library listed by `steamapps/libraryfolders.vdf`; fallback the window title. - cover: `appcache/librarycache//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/.jpg` (or `.png`). - total minutes: `playtime.dat` line ` ` (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/"|null, "minutes": |null, "session": }} `session` is the time deck-it first saw the game (same rule as Xbox). A cover is served at `/api/games/image/` 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.