27 lines
719 B
Plaintext
27 lines
719 B
Plaintext
|
#!/bin/bash
|
||
|
#
|
||
|
# Manage ALSA Master channel
|
||
|
|
||
|
test "$1" = "-h" && echo "usage `basename $0` [up|down|mute]" && exit 0
|
||
|
|
||
|
level() {
|
||
|
amixer get Master | sed -n 's/^.*\[\([0-9]\+%\).*$/\1/p' | uniq
|
||
|
|
||
|
}
|
||
|
|
||
|
state() {
|
||
|
amixer get Master | sed -n 's/^.*\[\(o[nf]\+\)]$/\1/p' | uniq
|
||
|
|
||
|
}
|
||
|
|
||
|
test $# -eq 0 && echo "`level` `state`" && exit 0
|
||
|
|
||
|
case $1 in
|
||
|
up) amixer set Master ${2:-5}%+ >/dev/null ||autoalsaconfamixer;;
|
||
|
down) amixer set Master ${2:-5}%- >/dev/null ||autoalsaconf;;
|
||
|
mute) amixer set Master toggle >/dev/null ||autoalsaconf;;
|
||
|
state|level) $1 ||autoalsaconf;;
|
||
|
set) amixer set Master $2% >/dev/null ||autoalsaconf;;
|
||
|
*) amixer set Master $1% >/dev/null ||autoalsaconf;;
|
||
|
esac
|