summaryrefslogtreecommitdiff
path: root/.scripts
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2022-10-04 08:26:13 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2022-10-04 08:26:13 +0530
commit38f4144eb1b8bbac7756ac38ce9d0b3b079c886f (patch)
tree6eaaac2da982db6d82e1ac183eaf7bd3f3288506 /.scripts
parent8b7927d16404ec45b2d6ef90b99cb775b41fa338 (diff)
attempting to replace pactl with wpctl
Diffstat (limited to '.scripts')
-rwxr-xr-x.scripts/volume23
1 files changed, 11 insertions, 12 deletions
diff --git a/.scripts/volume b/.scripts/volume
index 370f318..d1dc3e3 100755
--- a/.scripts/volume
+++ b/.scripts/volume
@@ -1,18 +1,17 @@
#!/bin/sh
-# Prints the current volume or 🔇 if muted.
+# Prints the current volume or 婢 if muted.
-[ $(pamixer --get-mute) = true ] && echo && exit
-vol="$(pamixer --get-volume)"
+vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
+# If muted, print 婢 and exit.
+[ "$vol" != "${vol%\[MUTED\]}" ] && echo 婢 && exit
-if [ "$vol" -gt "70" ]; then
- icon=" "
-elif [ "$vol" -gt "30" ]; then
- icon=" "
-elif [ "$vol" -gt "0" ]; then
- icon=" "
-else
- echo  && exit
-fi
+vol="$(echo "(""$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d' ' -f2)"*100")/1" | bc)"
+case 1 in
+ $((vol >= 70)) ) icon=" " ;;
+ $((vol >= 30)) ) icon=" " ;;
+ $((vol >= 1)) ) icon=" " ;;
+ * ) echo 婢 && exit ;;
+esac
echo "$icon$vol%"