# Phase 6 — Media ## Implemented - One shared native MPRIS service with dynamic discovery, metadata and capability-aware controls. - Large floating music widget: artwork, title, artist, album, seeking, elapsed/remaining time and player selector. - Optional `nowPlaying` bar module, added through Settings → Bar without changing saved module arrays. - Shared compact media card in Settings and a tested component for Phase 7 Control Center. - Media preferences now drive real views: visibility, artwork/progress/album, preferred player, monitor, corner, scale and optional Cava. - Restrained artwork fade and track-content motion honoring reduced motion. - One optional Cava process shared across views, stopped on pause or when no visible view needs it. The global accent remains independent of song artwork. Glass uses the existing neutral Theme. No new compositor, media daemon, audio daemon, system keybind or Nix configuration is introduced. ## Try it ```sh ./scripts/glassmxrph run quickshell ipc --path ./quickshell call shell openSettings media quickshell ipc --path ./quickshell call media status ``` Play a track in an MPRIS-capable app. Click previous/play/next, scrub a seekable track and switch players when multiple are available. Change monitor, corner and scale in Media settings. Add `nowPlaying` through the Bar editor. Enable Cava to visualize existing system audio. Selection order is explicit session selection, saved preferred DBus name or desktop-entry ID, a playing player, then the first available player. A disconnected player falls back immediately. Automatic ordering among several playing players follows the native model. Saved per-instance DBus names may change between app launches; a desktop-entry preference is more stable. ```sh quickshell ipc --path ./quickshell call media toggle quickshell ipc --path ./quickshell call media next quickshell ipc --path ./quickshell call media previous quickshell ipc --path ./quickshell call media seek 30 quickshell ipc --path ./quickshell call media select org.mpris.MediaPlayer2.PLAYER quickshell ipc --path ./quickshell call media select '' quickshell ipc --path ./quickshell call cava status ``` Commands act on the selected player. Unsupported actions return false. An empty selection restores preference/automatic selection. Durationless streams omit progress; absent artwork shows a music placeholder. Artwork is loaded asynchronously from the player-provided URL, which can require network access. Metadata quality and browser support depend on the application. ## Cava and layout limits Cava is optional, off by default and visualizes system audio rather than isolating the selected player. Its compiled default input backend must work with the existing audio server. The supplied config uses [upstream raw ASCII output options](https://github.com/karlstav/cava/blob/master/example_files/config); installed version 1.0.0 was exercised. Failures produce an inline message; toggle Cava off/on after fixing the underlying problem. No automatic installation or repeated crash restart is attempted. The music widget is a bottom-layer desktop surface: normal application windows can cover it. It uses the selected output's logical coordinates, falls back when that output is absent, and supports four corners. Margins currently leave room for the bar and bottom dock but do not perform general collision avoidance. Scaling is constrained by output size. Blur/refraction remains compositor-owned for Phase 9. Control Center itself is Phase 7: this phase supplies and validates its shared media component, not a new Control Center window. No metrics widget is added yet. Nix packaging/build integration remains deferred as requested. ## Validation QML and shared logic/provider tests pass. Private-DBus MPRIS fixtures cover two-player discovery, automatic/manual/preferred selection, removal/fallback, live metadata and artwork, capability guards, actual widget clicks, playback calls and seconds-to-microseconds seeking. Tests exercise unknown-duration streams, the bar and compact card, Cava frames, stop/resume/visibility behavior and failure/recovery, both connected outputs and missing-output fallback. Runtime logs are checked for warnings/errors. No real player's playback is changed. ```sh ./scripts/validate # Private DBus; needs Python dbus-python/PyGObject, QtTest, Cava and a real Wayland session: dbus-run-session -- python3 tests/media_runtime.py ``` Use an isolated project copy if an instance already uses this source path. Existing foundation/settings/launcher/dock/tray tests are also run before promotion. Screenshots and logs are ignored `.cache/` artifacts; they are not shipped or published. ## Changed files - `README.md` - `dependencies.json` - `docs/architecture.md` - `docs/compatibility.md` - `docs/phase-6.md` - `docs/validation.md` - `quickshell/bar/modules/NowPlayingModule.qml` - `quickshell/config/cava.conf` - `quickshell/controlcenter/modules/Media.qml` - `quickshell/core/ModuleRegistry.qml` - `quickshell/core/ShellState.qml` - `quickshell/helpers/cava.py` - `quickshell/media/CavaView.qml` - `quickshell/media/MediaCard.qml` - `quickshell/services/CavaService.qml` - `quickshell/services/ConfigLogic.js` - `quickshell/services/MediaService.qml` - `quickshell/services/qmldir` - `quickshell/settings/pages/Media.qml` - `quickshell/shell.qml` - `quickshell/testing/MediaDriver.qml` - `quickshell/widgets/MusicWidget.qml` - `tests/config.test.cjs` - `tests/media_runtime.py` - `tests/mpris_fixture.py`