From 67b0ec5741d327d27afe88783d85fcf2c4c4f204 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 3 Nov 2013 12:30:45 +0100 Subject: First commit --- bin/set_volume | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 bin/set_volume (limited to 'bin/set_volume') diff --git a/bin/set_volume b/bin/set_volume new file mode 100755 index 0000000..3168870 --- /dev/null +++ b/bin/set_volume @@ -0,0 +1,50 @@ +#!/bin/bash + +FUNCTIONS=$HOME/bin/functions.sh +[ -e $FUNCTIONS ] || exit 1 +. $FUNCTIONS + +LED=/sys/class/leds/0003:17EF:6009.0004:amber:mute/brightness + +function increase_volume() +{ + mute amixer sset Master 10%+ +} + +function decrease_volume() +{ + mute amixer sset Master 10%- +} + +function toggle_volume() +{ + state=$(amixer sget Master | grep -o '\[o[n|f]*\]' | head -n 1) + case "$state" in + "[on]") + mute amixer sset Master mute + mute amixer sset Headphone mute + mute amixer sset Speaker mute + echo 1 > $LED + ;; + "[off]") + mute amixer sset Master unmute + mute amixer sset Headphone unmute + mute amixer sset Speaker unmute + echo 0 > $LED + ;; + esac +} + +case "$1" in + increase) + increase_volume + ;; + decrease) + decrease_volume + ;; + toggle) + toggle_volume + ;; + *) + ;; +esac -- cgit v1.2.3-70-g09d2