# Development ## Architecture ```text AppleMusicWidget.qml │ ▼ AppleMusicService.qml ── Quickshell.Services.Mpris │ ▼ scripts/apple-music ── dedicated Chromium app/profile │ ▼ extension/chromium/duration-bridge.js ── MusicKit → Media Session duration ``` The service selects only the Chromium MPRIS name whose `.instance` suffix matches the PID of the dedicated Hyprland window. It never falls back to the first Chromium player, preventing a normal YouTube tab from being mistaken for Apple Music. ## Local setup Clone the repository and link it into Omarchy's user plugin directory: ```bash git clone https://github.com/iuliansafta/omarchy-apple-music.git cd omarchy-apple-music ln -s "$PWD" ~/.config/omarchy/plugins/iuliansafta.apple-music omarchy-shell shell rescanPlugins omarchy plugin enable iuliansafta.apple-music center ``` Files stored directly below `~/.config/omarchy/plugins/` hot reload when saved. When using the development symlink above, filesystem events may not cross the symlink; restart the shell after source changes: ```bash omarchy restart shell ``` Rescan after changing the manifest or adding the symlink: ```bash omarchy-shell shell rescanPlugins ``` ## Validation ```bash omarchy plugin validate . bash -n scripts/apple-music node tests/model.test.js node tests/duration-bridge.test.js ``` Check service state through shell IPC: ```bash omarchy-shell iuliansafta.apple-music status ``` Check recent loader errors: ```bash journalctl --user --since "2 minutes ago" | grep -Ei \ 'apple-music|qml.*(error|warn)|ReferenceError|TypeError' ``` ## MPRIS debugging List bus names without `playerctl`: ```bash busctl --user list | grep org.mpris.MediaPlayer2 ``` Inspect Chromium metadata, replacing `` with the value from the launcher: ```bash pid=$(scripts/apple-music pid) busctl --user get-property \ "org.mpris.MediaPlayer2.chromium.instance$pid" \ /org/mpris/MediaPlayer2 \ org.mpris.MediaPlayer2.Player Metadata ``` The service considers a duration valid only when it is positive and shorter than 24 hours. This filters Chromium's `INT64_MAX` duration while preserving normal tracks and long-form audio. For affected HLS tracks, the underlying `