mpris: pick the now-playing player by mixer category (music > games > all) #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "mpris-music-priority"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The now-playing strip held whichever player started first for as long as it kept playing, so a YouTube tab would keep the display even once a music app started.
rescan()now ranks players and lets the best-ranked Playing one win. Ranking comes from the app's mixer category viaConfigStore::categoryOf(), so the categories already edited in the mixer drive the strip too: music > games > everything else.allis the catch-all slot, so chat/hidden/uncategorized apps land there.Category lookup goes through a resolver callback rather than
MediaMprisdepending onConfigStore, keeping it testable standalone. The resolver keys on the MPRIS bus-name head (Feishin), which matches the config's app stems — the owning pid's executable is only a fallback, since every Electron app reports a generic/procexe (electron) and would otherwise be unclassifiable.The existing anti-flap behaviour is preserved: ties keep the incumbent, so two browser tabs don't fight over the display, and 'hold the current player when nothing is playing' is unchanged. Preemption requires a strictly better rank.
Verified against the real
config.jsonthrough the realConfigStore:The previous commit ranked players against a baked-in list of app names, which meant every new music player had to be added to the source. Rank by the app's mixer category instead, reusing ConfigStore::categoryOf() so the categories already edited in the mixer drive the now-playing strip too: music > games > everything else. "all" is the catch-all slot in the priority list -- any category not named (chat, hidden) and any uncategorized app rank there, so a category listed after "all" sorts below everything unknown. Category lookup goes through a resolver callback rather than MediaMpris depending on ConfigStore directly, which keeps it testable standalone. The resolver keys on the MPRIS bus-name head ("Feishin"), which matches the config's app stems; the owning pid's executable is only a fallback, since every Electron app reports a generic /proc exe ("electron") and would otherwise be unclassifiable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>