Script to change audio volume

From DRC

Jump to: navigation, search
#!/bin/sh

control=PCM,0

if [ $1 == "up" ]; then
        amixer sset $control 2+
fi

if [ $1 == "down" ]; then
        amixer sset $control 2-
fi

if [ $1 == "mute" ] ; then
        if [ -f /etc/oldvol ] ; then
                amixer -q sset $control `cat /etc/oldvol`
                rm /etc/oldvol
        else
                amixer sget $control | tail -1 | awk '{ print $3 }' > /etc/oldvol
                amixer -q sset $control 0%
        fi
fi
Personal tools