Open liamnoone opened 10 years ago
MPRIS2 does define a org.mpris.MediaPlayer2.CanRaise
property, and a corresponding org.mpris.MediaPlayer2.Raise()
method; it would be simple to implement them in mpDris2. (In fact, I did that while writing this reply.)
However, both Unity and the GNOME Shell's "Media player indicator" extension will prefer to activate the player app directly through its .desktop file. This means that if CanRaise was set to true, Unity would just try to start mpDris2 again (according to Exec=mpDris2
). (In the current version, this would result in the new mpDris2 instance simply replacing the old one.) If you changed the Exec=
line, then you could have Unity launch Sonata – but then it wouldn't launch mpDris2 itself.
I guess the 'replace' behaviour could become an option, like --replace
in things like gnome-shell or gnome-settings-daemon, and a second mpDris2 instance could just run the "player" command, but I'm undecided whether this isn't too much of a hack...
As for when the controls are displayed, it depends entirely on the MPRIS client – e.g. GNOME Shell (still talking about the same extension) only displays controls for players it sees on the bus; I think Unity does pretty much the same.
This means that you should already see the desired behavior, as mpDris2 always releases the bus name when it loses connection, and only re-acquires it after reconnecting to mpd... (unless you're using a really old pre-0.1 release, that is.) You can check using dbus-monitor member=NameOwnerChanged
or dbus-name -ew
.
Currently if mpDris2 didn't have a .desktop file the shell extension would try to call Raise() instead of running mpDris2 directly.
IIRC I prefer using the shell API to bring the application to the front so that the current workspace is used.
I'm not explaining this well, but here it goes anyways.
It'd be great if there was a configuration option for what happens when you click the indicator title. In Unity/Pantheon (at least), you can click the name of the player (in the sound indicator dropdown) and it'll open up that player, which is especially helpful if it's closed. So if I have VLC installed and listed, and I click on the VLC text, it'll launch/switch to VLC. It'd be good if you could add (for example)
player = "sonata [or ncmpcpp]"
, click "Music Player Daemon" and it'll launch the provided application.In addition, it'd be a nice aesthetic change to only display the controls when mpd is currently running. Is this within the scope of
MPRIS
?