[media controller applet] Support MPRIS services where CanPause==false

Authored by kossebau on Mar 2 2018, 3:45 PM.



Currently the media controller only works with MPRIS services which support
the PlayPause command. By the MPRIS spec this is an optional feature though.
While most players out there support this, the MPRIS support in Gwenview
currently worked on does not (would need some more rewrite of internals).
Which makes the Media controller applet and/or Gwenview look broken :)

To keep the current design with a central Play/Not Play button, this patch
changes its behaviour depending on the CanPause flag:
CanPause=true -> show either Play or Pause
CanPause=false -> show Play enabled/disabled

Diff Detail

R120 Plasma Workspace
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Mar 2 2018, 3:45 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 2 2018, 3:45 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
kossebau requested review of this revision.Mar 2 2018, 3:45 PM
kossebau updated this revision to Diff 28619.Mar 4 2018, 6:33 PM

set PassiveStatus also for state=="stopped"

kossebau updated this revision to Diff 28709.Mar 5 2018, 1:15 PM

use play() & pause() everywhere instead of playpause()

kossebau updated this revision to Diff 28777.Mar 6 2018, 3:06 AM
  • remove Stop state again
  • simply disable Pause button if CanPause==false
  • still use media-playback-stop button as status when neither paused nor playing

Other than those nitpicks would be good to go I guess


Shouldn't that be a binding? If the player cannot pause, the entry would just not show up rather than become disabled, ie. keep the action as "playPause" maybe?


Not a huge fan of that stopped icon in the panel


Please don't mix manual toggling and playPause, just do it manually then, otherwise the code becomes a bit convoluted

kossebau marked an inline comment as done.Mar 6 2018, 9:13 AM
kossebau added inline comments.

Not sure myself (but the doubled canPause looks strange on second read).

In the context menu of the taskmanager all media actions are kept and only disabled if not possible, with play/pause action though being same and switching label for canPause.
Would be good to be consistent. Not sure what I prefer.

So no menu entry for Play if playing and !canPause? Instead of disabled menu entry?


The icon will not be visible in the system tray, as it's only used when neither playing or paused, and then the status is passive, so hidden in system tray.

Showing the stopped icon on the compact version of the applet in general makes sense for me, to really show it's in a different state.

kossebau updated this revision to Diff 28806.Mar 6 2018, 11:01 AM

make play/pause action behaviour in context menu consistent with the one for taskmanager

kossebau edited the summary of this revision. (Show Details)Mar 6 2018, 12:09 PM
kossebau edited the test plan for this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Mar 6 2018, 12:09 PM
This revision was automatically updated to reflect the committed changes.