summaryrefslogtreecommitdiffstats
path: root/.local/bin/statusbar/volume
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-11-23 23:37:40 -0500
committerLuke Smith <luke@lukesmith.xyz>2019-11-23 23:37:40 -0500
commit09632e19ce560ebd9ea968c7170eadd8e7555e71 (patch)
treeeda6597a8f3478a4b20d63897933011892251a14 /.local/bin/statusbar/volume
parent24325dd124dc31924fd1f995fcb78cc8f3bf5c08 (diff)
downloadeibhear-09632e19ce560ebd9ea968c7170eadd8e7555e71.tar.gz
eibhear-09632e19ce560ebd9ea968c7170eadd8e7555e71.tar.zst
eibhear-09632e19ce560ebd9ea968c7170eadd8e7555e71.zip
volume module switched to alsa
Diffstat (limited to '.local/bin/statusbar/volume')
-rwxr-xr-x.local/bin/statusbar/volume14
1 files changed, 8 insertions, 6 deletions
diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume
index e66f0d9..3bf4fb0 100755
--- a/.local/bin/statusbar/volume
+++ b/.local/bin/statusbar/volume
@@ -1,18 +1,20 @@
#!/usr/bin/env sh
case $BLOCK_BUTTON in
- 1) setsid "$TERMINAL" -e pulsemixer & ;;
- 2) pulsemixer --toggle-mute ;;
- 4) pulsemixer --change-volume +5 ;;
- 5) pulsemixer --change-volume -5 ;;
+ 1) setsid "$TERMINAL" -e alsamixer & ;;
+ 2) amixer sset Master toggle ;;
+ 4) amixer sset Master 5%+ ;;
+ 5) amixer sset Master 5%- ;;
3) pgrep -x dunst >/dev/null && notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
- Middle click to mute.
- Scroll to change."
esac
-[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇\\n" && exit
+volstat="$(amixer get Master)"
-vol=$(pulsemixer --get-volume | awk '{print $1}')
+echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit
+
+vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed 's/[^0-9]*//g')
if [ "$vol" -gt "70" ]; then
icon="🔊"