#!/bin/sh

channels=`mixerctl $1 | cut -d "=" -f 2`
volume=`echo $channels | cut -d "," -f 1`
newvol=$volume

if [ $2 = "increase" ]
then
    newvol=$(($volume+10))
elif [ $2 = "decrease" ]
then
    newvol=$(($volume-10))
else
    echo "Unsupport argument. Use either increase or decrease."
fi

echo $newvol

if [ $newvol != $volume ]
then
    mixerctl -w $1=$newvol
    newval=`mixerctl $1 | cut -d "=" -f 2`
    pkill -SIGUSR1 herbe
    herbe "Volume ${newval}" &
fi
