diff options
| author | Ivan K. Boikov <mail@ikboikov.net> | 2025-02-03 21:38:49 +0100 |
|---|---|---|
| committer | Ivan K. Boikov <mail@ikboikov.net> | 2025-02-03 21:38:49 +0100 |
| commit | cbbf2aaf4d49e48283e9f7e748738cfe77900629 (patch) | |
| tree | 6fa54b271a078d68eae01ffdc65e5ec1bf5fab50 | |
| parent | 9ca13ac4e397230f867625de1a62084622727c11 (diff) | |
Restore accidentally nuked sb-volume
| -rwxr-xr-x | scripts/.local/bin/sb-volume | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/.local/bin/sb-volume b/scripts/.local/bin/sb-volume new file mode 100755 index 0000000..bfa7899 --- /dev/null +++ b/scripts/.local/bin/sb-volume @@ -0,0 +1,23 @@ +#!/bin/sh + +# Prints the current volume or MUT if muted. + +if [ "$(pamixer --get-mute)" = true ]; then + vol="MUT" +else + vol="$(pamixer --get-volume)" +fi + +if ! command -v pamixer ;then + vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" + case "$vol" in + *MUTED*) vol="MUT" ;; + *) vol=$(echo "100*$(echo "$vol" | cut -d' ' -f2)/1" | bc) ;; + esac +fi + +# for slstatus +printf "%s" "$vol" > "$XDG_RUNTIME_DIR/volume" + +# for dwmblocks +printf "%3d" "$vol" |
