summaryrefslogtreecommitdiffstats
path: root/polybar/OpenBSD-vol.sh
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2025-09-07 18:47:52 +0200
committerChristoph Schlosser <christoph@linux.com>2025-09-07 18:48:21 +0200
commit875b3add8f4e265eeabd125472fb6d5186d3f8d5 (patch)
tree8dba6a51a060fecec8d58e0777925698624a704e /polybar/OpenBSD-vol.sh
parent8e40fea5c0e42dc1204d35292e350d660ee3ed95 (diff)
downloaddots-875b3add8f4e265eeabd125472fb6d5186d3f8d5.tar.gz
polybar: Add config
Diffstat (limited to 'polybar/OpenBSD-vol.sh')
-rwxr-xr-xpolybar/OpenBSD-vol.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/polybar/OpenBSD-vol.sh b/polybar/OpenBSD-vol.sh
new file mode 100755
index 0000000..ff083f2
--- /dev/null
+++ b/polybar/OpenBSD-vol.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+function sndio_val() {
+ sndioctl "$1" | awk -F'=' '{print $2}'
+}
+
+while true; do
+ LEVEL=$(sndio_val output.level | bc)
+ MUTE=$(sndio_val output.mute)
+ if [[ $MUTE -eq 1 ]]; then
+ echo 'muted'
+ else
+ LEVEL=${LEVEL/./}
+ echo "$(( LEVEL/10 ))%"
+ fi
+ sleep 1
+done