summaryrefslogtreecommitdiff
path: root/vol
diff options
context:
space:
mode:
Diffstat (limited to 'vol')
-rwxr-xr-xvol17
1 files changed, 13 insertions, 4 deletions
diff --git a/vol b/vol
index 778abf9..662b92e 100755
--- a/vol
+++ b/vol
@@ -2,13 +2,22 @@
# A small volume control script for the laptop
-cmd="amixer set Master"
+if [ "$1" == "--headphone" ]; then
+ shift;
+ mixer="Headphone"
+else
+ mixer="Master"
+fi;
+
+cmd="amixer set $mixer"
fle=$HOME/.vol
+
+echo -n $mixer\ > $fle
case "$1" in
- "up") $cmd 2%+;;
- "down") $cmd 2%-;;
+ "--up") $cmd 2%+;;
+ "--down") $cmd 2%-;;
*) $cmd toggle;;
-esac | grep \% | cut -d\ -f 6,8 | tr -d '[]' > $fle
+esac | tail -n 1 | cut -d: -f 2 | cut -d\ -f 4,6 | tr -d '[]' >> $fle
for c in "set bargravity ne" "echo Volume: `cat $fle`" "set bargravity c"; do
ratpoison -c "$c"