diff --git a/applet/contents/config/main.xml b/applet/contents/config/main.xml --- a/applet/contents/config/main.xml +++ b/applet/contents/config/main.xml @@ -15,6 +15,18 @@ true + + + true + + + + true + + + + true + true diff --git a/applet/contents/ui/ConfigGeneral.qml b/applet/contents/ui/ConfigGeneral.qml --- a/applet/contents/ui/ConfigGeneral.qml +++ b/applet/contents/ui/ConfigGeneral.qml @@ -29,6 +29,9 @@ Kirigami.FormLayout { property alias cfg_volumeStep: volumeStep.value property alias cfg_volumeFeedback: volumeFeedback.checked + property alias cfg_volumeOsd: volumeOsd.checked + property alias cfg_micOsd: micOsd.checked + property alias cfg_muteOsd: muteOsd.checked property alias cfg_outputChangeOsd: outputChangeOsd.checked VolumeFeedback { @@ -68,8 +71,24 @@ enabled: feedback.valid } + QQC2.CheckBox { + id: volumeOsd + Kirigami.FormData.label: i18n("Visual feedback:") + text: i18n("When volume changes") + } + + QQC2.CheckBox { + id: micOsd + text: i18n("When microphone volume changes") + } + + QQC2.CheckBox { + id: muteOsd + text: i18n("When mute state changes") + } + QQC2.CheckBox { id: outputChangeOsd - text: i18n("Display notification when default output device changes") + text: i18n("When default output device changes") } } diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml --- a/applet/contents/ui/main.qml +++ b/applet/contents/ui/main.qml @@ -101,7 +101,7 @@ var percent = volumePercent(volume, currentMaxVolumeValue); paSinkModel.preferredSink.muted = percent == 0; paSinkModel.preferredSink.volume = volume; - osd.show(percent); + showOsdVolume(percent); playFeedback(); } @@ -113,7 +113,7 @@ var percent = volumePercent(volume, currentMaxVolumeValue); paSinkModel.preferredSink.muted = percent == 0; paSinkModel.preferredSink.volume = volume; - osd.show(percent); + showOsdVolume(percent); playFeedback(); } @@ -124,13 +124,13 @@ var toMute = !paSinkModel.preferredSink.muted; if (toMute) { enableGlobalMute(); - osd.show(0); + showOsdMute(0); } else { if (globalMute) { disableGlobalMute(); } paSinkModel.preferredSink.muted = toMute; - osd.show(volumePercent(paSinkModel.preferredSink.volume, currentMaxVolumeValue)); + showOsdMute(volumePercent(paSinkModel.preferredSink.volume, currentMaxVolumeValue)); playFeedback(); } } @@ -143,7 +143,7 @@ var percent = volumePercent(volume, currentMaxVolumeValue); paSourceModel.defaultSource.muted = percent == 0; paSourceModel.defaultSource.volume = volume; - osd.showMicrophone(percent); + showOsdMic(percent); } function decreaseMicrophoneVolume() { @@ -154,16 +154,16 @@ var percent = volumePercent(volume, currentMaxVolumeValue); paSourceModel.defaultSource.muted = percent == 0; paSourceModel.defaultSource.volume = volume; - osd.showMicrophone(percent); + showOsdMic(percent); } function muteMicrophone() { if (!paSourceModel.defaultSource) { return; } var toMute = !paSourceModel.defaultSource.muted; paSourceModel.defaultSource.muted = toMute; - osd.showMicrophone(toMute? 0 : volumePercent(paSourceModel.defaultSource.volume, currentMaxVolumeValue)); + showOsdMicMute(toMute? 0 : volumePercent(paSourceModel.defaultSource.volume, currentMaxVolumeValue)); } function playFeedback(sinkIndex) { @@ -176,6 +176,30 @@ feedback.play(sinkIndex); } + function showOsdVolume(text) { + if (!Plasmoid.configuration.volumeOsd) + return + osd.show(text) + } + + function showOsdMute(text) { + if (!Plasmoid.configuration.muteOsd) + return + osd.show(text) + } + + function showOsdMic(text) { + if (!Plasmoid.configuration.micOsd) + return + osd.showMicrophone(text) + } + + function showOsdMicMute(text) { + if (!Plasmoid.configuration.mutecOsd) + return + osd.showMicrophone(text) + } + function enableGlobalMute() { var role = paSinkModel.role("Muted"); var rowCount = paSinkModel.rowCount();