From 318254623f3a7868050d4179be0d005ff35c5b28 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 19 Oct 2016 21:58:30 +0200 Subject: [PATCH] arch: add setter for volume.sh --- bin/arch/volume.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/arch/volume.sh b/bin/arch/volume.sh index 70c0bbc9..532f186c 100755 --- a/bin/arch/volume.sh +++ b/bin/arch/volume.sh @@ -2,16 +2,16 @@ if [[ $# == 0 ]] then - echo "Usage: volume.sh [+|-|unmute|mute]" - exit 1 + echo "$(amixer get Master | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)" + exit fi COMMAND=$1 case "$COMMAND" in - [+-]) amixer set Master 10%$COMMAND ;; - *mute) amixer set Master $COMMAND ;; - *) - echo "Invalid command" + [0-9]*) amixer set Master $COMMAND ;; + [+-]) amixer set Master 10%$COMMAND ;; + *mute) amixer set Master $COMMAND ;; + *) >&2 echo "Invalid command" exit 1 ;; esac