[Task Manager] Indicate applications playing audio
ClosedPublic

Authored by broulik on Nov 7 2016, 3:29 PM.

Details

Summary

This is similar to what most web browsers do nowadays, indicating when audio is being played with an option to mute it.

When an application has an audio stream and it is actually playing something ("not corked"), after a delay of 2 seconds (to avoid flashing briefly) an audio icon is displayed which disappears again once audio stops playing. The context menu always offers the "Mute" option whenever there's an audio stream provided by the application, so you can still unmute even after playback has stopped. Also, the "muted" icon will be shown whilst the application is muted, regardless of whether sound is actually being played.

An application is marked as "Muted" when all associated streams are muted, and toggling mute will (un)mute all of them. Since PulseAudio doesn't know windows, when an application has multiple windows, all of them will be flagged as playing audio; the same issue we already have with Unity Launcher API.

Test Plan

When plasma-pa is not available, the Loader will fail and the functionality is disabled. Should we mark plasma-pa as an optional runtime dependency or something like that?

Not very happy with the Instantiator hack but dealing with models from QML, urgh.

Depends on D3300 and D3301


Vertical icon-tasks manager, not ideal, but not super ugly imho

Diff Detail

Repository
R119 Plasma Desktop
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik updated this revision to Diff 7985.Nov 7 2016, 3:29 PM
broulik retitled this revision from to RFC: [Task Manager] Indicate applications playing audio.
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added reviewers: Plasma, Plasma: Design, hein, drosca.
broulik set the repository for this revision to R119 Plasma Desktop.
Restricted Application added a project: Plasma. · View Herald TranscriptNov 7 2016, 3:29 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik updated this object.Nov 7 2016, 3:31 PM
broulik edited the test plan for this revision. (Show Details)
broulik edited the test plan for this revision. (Show Details)
colomar added a subscriber: colomar.Nov 7 2016, 7:50 PM

Very useful patch!

The only thing I'm unsure of is the three-second delay. It might be a bit too long if some annoying applicaiton suddenly starts blaring sound and the option to mute it easily only becomes available after three seconds of torture.
I think two or maybe even one second might already be enough to keep the icon from blinking.

Note that the mute option is immediately available in the context menu and stays there even if the playback has finished (if the application keeps the stream open, e.g. a player that is just paused). The three seconds delay only applies to the icon but it could surely be reduced, given the duration of the fade-in for the icon is also 1s right now.

hein edited edge metadata.Nov 8 2016, 7:24 AM

Love this (well I suggested it :) and would be a nice first for Plasma Desktop. Code actually looks pretty good.

applets/taskmanager/package/contents/ui/Task.qml
288

?

364

Do we need "This application" or can we simplify to "Currently muted."?

588

Coding style: Missing trailing semicolon.

broulik updated this revision to Diff 8024.Nov 8 2016, 3:54 PM
broulik retitled this revision from RFC: [Task Manager] Indicate applications playing audio to [Task Manager] Indicate applications playing audio.
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik edited edge metadata.
  • Reduced delay for icon to 2 seconds
  • Let enabling/disabling the setting take effect immediately
  • Maximum size for icon and hide it when there's not enough room - should make it okay'ish for icon-only task manager in vertical panel
  • While the "is playing" icon is shown only when there's actually sound being played, the "muted" icon is - when the stream is muted - shown always when the application has an audio stream. This way you can immediately tell that an application is muted and it doesn't come to a surprise when it starts playing and you can't actually hear anything. (hard to explain in words)
apol added a subscriber: apol.Nov 8 2016, 3:55 PM

+1 really cool!

applets/taskmanager/package/contents/config/main.xml
92 ↗(On Diff #8024)

Do we really need to make it configurable?

broulik updated this revision to Diff 8026.Nov 8 2016, 3:57 PM
  • Handle pid changing in the model

Task bar can shuffle around tasks so the delegate is re-used but shows a different application; in this case we want to update. I just had Dolphin think it had an audio stream of Chrome

hein added a comment.Nov 9 2016, 10:05 AM

About vert panels, maybe if the button becomes big enough it should show as a corner badge?

maybe if the button becomes big enough it should show as a corner badge?

I tried, using a ShaderEffect like for the badge but I couldn't get it to work well or look great, especially since it needs to completely change for when there is a label (where it looks beautiful as seen in the screenshot).

How should we proceed here? Easiest option would be to not show the indicator if the button is too small but that'll surely keep the feature from icon tasks. :/

romangg added a subscriber: romangg.EditedDec 25 2016, 1:40 PM

Could this be a solution? The icon needs to be reduced a little bit in size maybe when showing the indicator.

I like the idea but depending on the icon, especially non-round ones, might look terrible.

broulik updated this revision to Diff 9750.Jan 5 2017, 10:11 AM
  • Improve visuals for icon-only mode
  • Put Audio Icon into separate qml file
broulik edited the test plan for this revision. (Show Details)Jan 5 2017, 10:12 AM

and when I make a new emblem icon for audio on/off this would have an background circle and inside the mute/volume on icon like we have it for owncloud, ...

hein accepted this revision.Jan 6 2017, 5:30 AM
hein edited edge metadata.
This revision is now accepted and ready to land.Jan 6 2017, 5:30 AM

Last try: It's the speaker symbol without the speaker. Should be easy to make by just cutting away the speaker. Plus vertically centered to the app icon.

broulik updated this revision to Diff 9891.Jan 9 2017, 7:15 AM
broulik edited edge metadata.
  • Rebased on master with new tooltip design
This revision was automatically updated to reflect the committed changes.