summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-09-09 21:40:07 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2025-09-09 21:40:07 +0200
commit9fab3828698199718a3d2f2faf8826f77d9258f7 (patch)
tree6e6d567a3877b425bdd0329e898cd00013c766fb /accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml
parentdf1632d1c15cba4b7a361f8159b9988919ef8277 (diff)
downloadnixos-9fab3828698199718a3d2f2faf8826f77d9258f7.tar
nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.tar.gz
nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.tar.bz2
nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.tar.xz
nixos-9fab3828698199718a3d2f2faf8826f77d9258f7.zip
...
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml55
1 files changed, 41 insertions, 14 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml b/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml
index 02dcf227..16fb5dea 100644
--- a/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml
+++ b/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml
@@ -7,11 +7,11 @@ import Quickshell.Widgets
7Scope { 7Scope {
8 id: root 8 id: root
9 9
10 property bool show: false 10 property string show: ""
11 property bool inhibited: true 11 property bool inhibited: true
12 12
13 PwObjectTracker { 13 PwObjectTracker {
14 objects: [ Pipewire.defaultAudioSink ] 14 objects: [ Pipewire.defaultAudioSink, Pipewire.defaultAudioSource ]
15 } 15 }
16 16
17 Connections { 17 Connections {
@@ -19,11 +19,25 @@ Scope {
19 target: Pipewire.defaultAudioSink?.audio 19 target: Pipewire.defaultAudioSink?.audio
20 20
21 function onVolumeChanged() { 21 function onVolumeChanged() {
22 root.show = true; 22 root.show = "sink";
23 hideTimer.restart(); 23 hideTimer.restart();
24 } 24 }
25 function onMutedChanged() { 25 function onMutedChanged() {
26 root.show = true; 26 root.show = "sink";
27 hideTimer.restart();
28 }
29 }
30
31 Connections {
32 enabled: Pipewire.defaultAudioSource
33 target: Pipewire.defaultAudioSource?.audio
34
35 function onVolumeChanged() {
36 root.show = "source";
37 hideTimer.restart();
38 }
39 function onMutedChanged() {
40 root.show = "source";
27 hideTimer.restart(); 41 hideTimer.restart();
28 } 42 }
29 } 43 }
@@ -36,7 +50,7 @@ Scope {
36 Timer { 50 Timer {
37 id: hideTimer 51 id: hideTimer
38 interval: 1000 52 interval: 1000
39 onTriggered: root.show = false 53 onTriggered: root.show = ""
40 } 54 }
41 55
42 Timer { 56 Timer {
@@ -44,7 +58,7 @@ Scope {
44 interval: 100 58 interval: 100
45 running: true 59 running: true
46 onTriggered: { 60 onTriggered: {
47 root.show = false; 61 root.show = "";
48 root.inhibited = false; 62 root.inhibited = false;
49 } 63 }
50 } 64 }
@@ -97,13 +111,20 @@ Scope {
97 implicitHeight: parent.height 111 implicitHeight: parent.height
98 112
99 icon: { 113 icon: {
100 if (!Pipewire.defaultAudioSink || Pipewire.defaultAudioSink.audio.muted) 114 if (root.show == "sink") {
101 return "volume-off"; 115 if (!Pipewire.defaultAudioSink || Pipewire.defaultAudioSink.audio.muted)
102 if (Pipewire.defaultAudioSink.audio.volume <= 0.33) 116 return "volume-off";
103 return "volume-low"; 117 if (Pipewire.defaultAudioSink.audio.volume <= 0.33)
104 if (Pipewire.defaultAudioSink.audio.volume <= 0.67) 118 return "volume-low";
105 return "volume-medium"; 119 if (Pipewire.defaultAudioSink.audio.volume <= 0.67)
106 return "volume-high"; 120 return "volume-medium";
121 return "volume-high";
122 } else if (root.show == "source") {
123 if (!Pipewire.defaultAudioSource || Pipewire.defaultAudioSource.audio.muted)
124 return "microphone-off";
125 return "microphone";
126 }
127 return "volume-high";
107 } 128 }
108 } 129 }
109 130
@@ -123,7 +144,13 @@ Scope {
123 144
124 color: Pipewire.defaultAudioSink?.audio.muted ? "#70ffffff" : "white" 145 color: Pipewire.defaultAudioSink?.audio.muted ? "#70ffffff" : "white"
125 146
126 implicitWidth: parent.width * (Pipewire.defaultAudioSink?.audio.volume ?? 0) 147 implicitWidth: {
148 if (root.show == "sink")
149 return parent.width * (Pipewire.defaultAudioSink?.audio.volume ?? 0);
150 else if (root.show == "source")
151 return parent.width * (Pipewire.defaultAudioSource?.audio.volume ?? 0);
152 return 0;
153 }
127 } 154 }
128 } 155 }
129 } 156 }