summaryrefslogtreecommitdiff
path: root/.local/bin/dwmbar/dwmb-volume
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/dwmbar/dwmb-volume')
-rwxr-xr-x.local/bin/dwmbar/dwmb-volume22
1 files changed, 22 insertions, 0 deletions
diff --git a/.local/bin/dwmbar/dwmb-volume b/.local/bin/dwmbar/dwmb-volume
new file mode 100755
index 0000000..422c6e6
--- /dev/null
+++ b/.local/bin/dwmbar/dwmb-volume
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Low volume threshold (for the icon to change)
+low="50"
+
+# High volume icon
+icon=" "
+
+# Get the percentage
+vol="$(amixer sget Master | tail -n 1 | sed "s/.*\[\([0-9]*\)%\]/\1/")"
+
+# Change to low volume icon if below threshold
+[[ "$vol" -lt "$low" ]] && \
+icon=" "
+
+# Change to muted icon if necessary
+echo $vol | grep off &>/dev/null && icon=" "
+
+echo " $icon$(echo $vol | sed "s/\s\[.*//")%"
+
+#   
+