aboutsummaryrefslogtreecommitdiffstats
path: root/bin/set_volume
diff options
context:
space:
mode:
Diffstat (limited to 'bin/set_volume')
-rwxr-xr-xbin/set_volume50
1 files changed, 50 insertions, 0 deletions
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