[Applet]Add global mute function

Authored by gvgeo on Jan 4 2020, 12:33 PM.



Add a Mute icon that will force all playback devices to mute. Even if new
device/port connects, will automatically mute.
Does not work as an indicator. It is possible for all the devices to be
muted and the icon to be disabled. It acts as a force switch.
Is aware of devices that were muted before. So that will be able to unmute
only the devices that actually mute. With an exception if all the devices
were muted.
Gets disabled when manually unmute a device.
Stores values in config file, for reboot etc.

Part of T10470 layout changes.

Depends on D26256

BUG: 396835

Diff Detail

R115 Plasma Audio Volume Applet
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
gvgeo created this revision.Jan 4 2020, 12:33 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 4 2020, 12:33 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
gvgeo requested review of this revision.Jan 4 2020, 12:33 PM
gvgeo retitled this revision from [APPLET]Add global mute function to [Applet]Add global mute function.Jan 4 2020, 12:34 PM
gvgeo added a comment.Jan 4 2020, 1:01 PM

Icon is not monochrome. Is there an alternative? Or have to do it with desaturate graphical effect?

With the current functionality, fits nice to make it colored when all the devices are muted. This adds a semi enabled state, when global mute is not enabled.

Function wise, can ignore this patch, and instead make it as a dummy indicator, switch. Muting/unmuting all the devices.
That way when a new unmute device added or an unmuted port connects, global mute icon will disable, without affecting any other device state.

gvgeo updated this revision to Diff 72753.Jan 4 2020, 3:54 PM


ngraham added a subscriber: ngraham.Jan 4 2020, 4:27 PM

Nice. One thing I notice is that when I press the mute button on my keyboard, it triggers the applet to enter the muted state for the (sole) audio output, but it does not trigger the new global muted state. Could it do this?

Current icon is fine BTW.

gvgeo updated this revision to Diff 72762.EditedJan 4 2020, 6:18 PM

Add global mute for shortcuts/tray icon.
Will prioritize current sink mute state, and accordingly will also trigger global mute.

Triggers differently than the global mute icon button.

If default is muted but an other device is not muted,
icon will force global mute enable,
while the shortcut will unmute the default.

ngraham accepted this revision as: VDG.Jan 4 2020, 8:38 PM

UI and functionality are good. I'll leave the code review to a Plasma person or @drosca. There is quite a lot of added code.

Code looks sane enough except for one thing:


This makes me nervous. How do we know it will have initialized after 200 ms? Is there an onFinished signal we can listen for or something? Could we make one?

gvgeo planned changes to this revision.Jan 5 2020, 5:24 AM

Will remove timer,onRowsInserted in paSinkModel does the same during init.

And will move forceGlobalMute inside paSinkModel.

gvgeo updated this revision to Diff 72857.Jan 6 2020, 9:44 AM

Planed changes

gvgeo marked an inline comment as done.Jan 6 2020, 9:52 AM
ngraham accepted this revision.Jan 6 2020, 3:18 PM

Much better, thanks.

This revision is now accepted and ready to land.Jan 6 2020, 3:18 PM
gvgeo updated this revision to Diff 72916.Jan 6 2020, 6:59 PM


gvgeo updated this revision to Diff 73240.Jan 10 2020, 10:24 PM

Removal of trailing space

ngraham edited the summary of this revision. (Show Details)Jan 13 2020, 4:13 PM
gvgeo updated this revision to Diff 74149.EditedJan 22 2020, 5:43 PM

Last update was by accident...

This revision was automatically updated to reflect the committed changes.