summaryrefslogtreecommitdiffstats
path: root/.local/bin/statusbar/sb-volume
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/statusbar/sb-volume')
-rwxr-xr-x.local/bin/statusbar/sb-volume11
1 files changed, 6 insertions, 5 deletions
diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume
index d17ce66..acdf7a9 100755
--- a/.local/bin/statusbar/sb-volume
+++ b/.local/bin/statusbar/sb-volume
@@ -4,9 +4,9 @@
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e pulsemixer ;;
- 2) pamixer -t ;;
- 4) pamixer --allow-boost -i 1 ;;
- 5) pamixer --allow-boost -d 1 ;;
+ 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;;
+ 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;;
+ 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;;
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
- Middle click to mute.
- Scroll to change." ;;
@@ -19,14 +19,15 @@ vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
vol="${vol#Volume: }"
+
split() {
# For ommiting the . without calling and external program.
IFS=$2
set -- $1
printf '%s' "$@"
}
-vol="$(split "$vol" ".")"
-vol="${vol##0}"
+
+vol="$(printf "%.0f" "$(split "$vol" ".")")"
case 1 in
$((vol >= 70)) ) icon="🔊" ;;