From c55dd3075dbd7271b285da15bfad25a0f5ef47f9 Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Wed, 7 Jan 2026 13:28:24 +0530 Subject: how was volume even working upto now --- nixos/services.nix | 3 +-- quickshell/Procs.qml | 16 +++++++++++----- quickshell/items/Waves.qml | 2 +- quickshell/scripts/volume.sh | 2 -- quickshell/shell.qml | 1 + 5 files changed, 14 insertions(+), 10 deletions(-) delete mode 100755 quickshell/scripts/volume.sh diff --git a/nixos/services.nix b/nixos/services.nix index 4063111..d0c2937 100644 --- a/nixos/services.nix +++ b/nixos/services.nix @@ -21,8 +21,7 @@ }; services.blueman.enable = true; services.printing.enable = true; - services.pulseaudio.enable = false; - services.pipewire = { + services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; diff --git a/quickshell/Procs.qml b/quickshell/Procs.qml index 8987b76..c26c312 100644 --- a/quickshell/Procs.qml +++ b/quickshell/Procs.qml @@ -56,7 +56,7 @@ Scope { command: ["sh", "-c", "~/.config/quickshell/scripts/cpu_temp.sh"] stdout: SplitParser { onRead: data => { - cpu_temperature = parseInt(data.trim()) || 0; + cpu_temperature = parseInt(data.trim()) || 0 } } Component.onCompleted: running = true @@ -77,10 +77,16 @@ Scope { Process { id: volumeProc - command: ["sh", "-c", "~/.config/quickshell/scripts/volume.sh"] + command: ["sh", "-c", "wpctl get-volume @DEFAULT_AUDIO_SINK@"] stdout: SplitParser { onRead: data => { - volume = parseInt(data.trim()) || 0; + var parts = data.trim().split(/\s+/) + if (parts.length == 3) { + volume_muted = true; + } else { + volume_muted = false; + } + volume = (parseFloat(parts[1].trim()) || 0) * 100 } } Component.onCompleted: running = true @@ -92,8 +98,8 @@ Scope { stdout: SplitParser { onRead: data => { var parts = data.trim().split(/\s+/) - battery = parseInt(parts[0]) || 0; - batteryCharging = parseInt(parts[1]) || false; + battery = parseInt(parts[0]) || 0 + batteryCharging = parseInt(parts[1]) || false } } Component.onCompleted: running = true diff --git a/quickshell/items/Waves.qml b/quickshell/items/Waves.qml index 05e42e2..f8c0359 100644 --- a/quickshell/items/Waves.qml +++ b/quickshell/items/Waves.qml @@ -13,7 +13,7 @@ RowLayout { } Text { text: volume - color: shellRoot.green + color: volume_muted ? shellRoot.red : shellRoot.green font { family: shellRoot.fontFamily pixelSize: shellRoot.fontSize diff --git a/quickshell/scripts/volume.sh b/quickshell/scripts/volume.sh deleted file mode 100755 index 3059255..0000000 --- a/quickshell/scripts/volume.sh +++ /dev/null @@ -1,2 +0,0 @@ -volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '\d+(?=%)' | head -n 1) -echo "$volume" diff --git a/quickshell/shell.qml b/quickshell/shell.qml index eb595e8..e012535 100644 --- a/quickshell/shell.qml +++ b/quickshell/shell.qml @@ -57,6 +57,7 @@ ShellRoot { property int brightness: 100 property int temperature: 6000 property int volume: 12 + property bool volume_muted: false property int battery: 12 property bool batteryCharging: false property string wifiName: "Offline" -- cgit v1.2.3