From 3da805616d8c8ffc6ae70fdae96ecf366ecdd51c Mon Sep 17 00:00:00 2001 From: Eric Phillips Date: Sun, 12 Jun 2016 22:29:42 -0600 Subject: [PATCH] script to set volume and send notification to twmn --- volumeset.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 volumeset.sh diff --git a/volumeset.sh b/volumeset.sh new file mode 100755 index 0000000..9048b53 --- /dev/null +++ b/volumeset.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# script for changing the volume and sending +# notification to twmn using twmnc + +step=1 + +if [[ $# -eq 1 ]]; then + case $1 in + "up") + amixer set Master $step%+ + direction='increased to ';; + "down") + amixer set Master $step%- + direction='decreased to ';; + "mute") + amixer set Master toggle;; + *) + echo "Invalid option";; + esac +fi + +muted=`amixer get Master | grep "Front Left:" | awk '{print $6}'` +vol=`amixer get Master | grep "Front Left:" | awk '{print $5}' | tr -d '[]'` + +if [[ $muted == "[off]" ]]; then + twmnc -t 'volume' -c 'muted' -d 1000 +else + twmnc -t 'volume' -c "${direction}${vol}" -d 1000 +fi