summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2017-01-12 14:16:44 +0100
committerKai Uwe Broulik <[email protected]>2017-01-12 14:16:44 +0100
commitdcfad7d1233a7accd6be6316e36d64826c86ce82 (patch)
tree2ce030655540fb34d2ed78ed77e14db17ed1bebe
parentc4adba4ce9c64675880475a02553814a3fb97763 (diff)
Show percentage in tooltip maintext and indicate when muted
Compacts the tooltip to say "Volume at %" in its title and the device name in the sub text. Also, indicate when audio is muted. Differential Revision: https://phabricator.kde.org/D4100
-rw-r--r--applet/contents/ui/main.qml15
1 files changed, 13 insertions, 2 deletions
diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml
index a8cd62a..0a371d9 100644
--- a/applet/contents/ui/main.qml
+++ b/applet/contents/ui/main.qml
@@ -48,8 +48,19 @@ Item {
Plasmoid.icon: sinkModel.preferredSink ? Icon.name(sinkModel.preferredSink.volume, sinkModel.preferredSink.muted) : Icon.name(0, true)
Plasmoid.switchWidth: units.gridUnit * 12
Plasmoid.switchHeight: units.gridUnit * 12
- Plasmoid.toolTipMainText: displayName
- Plasmoid.toolTipSubText: sinkModel.preferredSink ? i18n("Volume at %1%\n%2", volumePercent(sinkModel.preferredSink.volume), sinkModel.preferredSink.description) : ""
+ Plasmoid.toolTipMainText: {
+ var sink = sinkModel.preferredSink;
+ if (!sink) {
+ return displayName;
+ }
+
+ if (sink.muted) {
+ return i18n("Audio Muted");
+ } else {
+ return i18n("Volume at %1%", volumePercent(sink.volume));
+ }
+ }
+ Plasmoid.toolTipSubText: sinkModel.preferredSink ? sinkModel.preferredSink.description : ""
function boundVolume(volume) {
return Math.max(PulseAudio.MinimalVolume, Math.min(volume, maxVolumeValue));