scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit f04b62b7eea101104e3352e7047e166ed4947784
parent e9a6176d1249f8783c1769570ebfceec39eecd73
Author: z3bra <willy@mailoo.org>
Date:   Thu Apr  3 10:37:26 +0200

Volume manager

Diffstat:
volume | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)
diff --git a/volume b/volume @@ -0,0 +1,24 @@ +#!/bin/sh +# +# z3bra - (c) wtfpl 2014 +# Manage ALSA Master channel + +test "$1" = "-h" && echo "usage `basename $0` [+|-|!]" && 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 + +) amixer set Master 5%+ >/dev/null;; + -) amixer set Master 5%- >/dev/null;; + !) amixer set Master toggle >/dev/null;; + *) amixer set Master $1 >/dev/null;; +esac +