#!/bin/sh

increase() {
    _vol=$(echo "$(sndioctl -n output.level) + 0.05" | bc)
    sndioctl output.level=$_vol 2>&1 || sndioctl output.level=1

}
decrease() {
    _vol=$(echo "$(sndioctl -n output.level) - 0.05" | bc)
    sndioctl output.level=$_vol || sndioctl output.level=0
}

case $1 in
    "+") increase; ;;
    "-") decrease; ;;
esac
dunstify -r 1 "Volume: $(sndioctl -n output.level | tr -d '.' | cut -b1-3 | bc)%"
