diff options
Diffstat (limited to 'polybar/OpenBSD-vol.sh')
| -rwxr-xr-x | polybar/OpenBSD-vol.sh | 17 |
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 |