-
Notifications
You must be signed in to change notification settings - Fork 90
Description
A lot of people are having trouble managing multiple media players with Playerctl. They would like it to always control the last "active player". This definition needs some fleshing out, but I think it approximates something like the last player to do some action like play, pause, switch track, open, etc.
This cannot be accomplished with a one-off command because we don't have access to the history of player actions. It could be accomplished if we had a daemon running to monitor player actions and contain the logic to determine what is the most active one.
To accomplish this, we could add a new binary to Playerctl called playerctld
. This should be activatable so it can be launched on demand by Playerctl (dbus supports this I think).
The daemon will implement org.mpris.MediaPlayer2.Player
as a proxy to the active player. So calling Play
on this interface will cause the active player to play by calling that method on the player and returning its result.
If we take the name org.mpris.MediaPlayer2.playerctld
, we can integrate this functionality into Playerctl without any modifications to the main binary, except maybe to activate the service on demand.
playerctl --player playerctld play
In this case, playerctld will give the command to whatever it decides is the active player.
More interfaces could be added to playerctld
at a later time to facilitate third-party widgets and other desktop tools to better integrate with Playerctl and the desktop.
Feedback on the approach is welcome.