aboutsummaryrefslogtreecommitdiff
path: root/scripts/audio_status.sh
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2016-01-11 16:50:10 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2016-01-11 16:50:10 +0100
commit90dc7e3a3779ec2517c30b972f2c46efc19d2706 (patch)
treefbe5855da5271000e02d4f3d33a4c13cb8dc0f59 /scripts/audio_status.sh
parent818caea23fcbb5219f64b90a65df445278f9cbcc (diff)
downloaddotfiles-90dc7e3a3779ec2517c30b972f2c46efc19d2706.tar.gz
dotfiles-90dc7e3a3779ec2517c30b972f2c46efc19d2706.zip
make i3bar volume info work with pamixer or amixer
1) change conkyrc file 2) add script that prints a status line follwing this scheme: M|U Volume:|<default pa device> [<volume>%]
Diffstat (limited to 'scripts/audio_status.sh')
-rwxr-xr-xscripts/audio_status.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/audio_status.sh b/scripts/audio_status.sh
new file mode 100755
index 0000000..84a6a01
--- /dev/null
+++ b/scripts/audio_status.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+function print_mute {
+ echo -n "M "
+}
+
+function print_unmute {
+ echo -n "U "
+}
+
+if type pamixer &>/dev/null
+then
+ if pamixer --get-mute &> /dev/null
+ then
+ print_mute
+ else
+ print_unmute
+ fi
+
+ echo -n $(pacmd info | grep 'Default sink' | grep -o '[^.]*$')
+
+ echo " [$(pamixer --get-volume)%]"
+
+elif type amixer &>/dev/null
+then
+ if [[ "$(amixer sget Master | grep '\[on\]')" == "" ]]
+ then
+ print_mute
+ else
+ print_unmute
+ fi
+
+ echo -n "Volume: "
+
+ echo "[$(amixer sget Master | grep Mono: | sed -e 's/[ \t]*Mono: Playback [0-9]* \[\([0-9]*%\)\].*/\1/')]"
+else
+ echo "please install either pamixer or amixer"
+fi