aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2016-01-09 21:03:01 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2016-01-09 21:14:06 +0100
commit818caea23fcbb5219f64b90a65df445278f9cbcc (patch)
treeb80e559b189b76fe75071807d6ba9e4eaa4c6cab /scripts
parentfed4daf04aca54f2c5c8cfeb74ecfa744fb77803 (diff)
downloaddotfiles-818caea23fcbb5219f64b90a65df445278f9cbcc.tar.gz
dotfiles-818caea23fcbb5219f64b90a65df445278f9cbcc.zip
make volume control work with amixer(ALSA) and pamixer(PA)
Add a helper script that use either amixer or pamixer for increase decrease and toggle mute. usage: audio_control.sh ((+ | -)<number> | toggle)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/audio_control.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/audio_control.sh b/scripts/audio_control.sh
new file mode 100644
index 0000000..7bbf7df
--- /dev/null
+++ b/scripts/audio_control.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+if type pamixer &> /dev/null
+then
+ command_inc="pamixer -i "
+ command_dec="pamixer -d "
+ command_toggle="pamixer -t"
+elif type amixer &> /dev/null
+then
+ command_inc="amixer -q set Master "
+ inc_suff="%+"
+ command_dec="amixer -q set Master "
+ dec_suff="%-"
+ command_toggle="amixer -q set Master toggle"
+else
+ command_inc="i3-nagbar -m \"please install amixer(ALSA) or pamixer(PA)\""
+ command_dec="i3-nagbar -m \"please install amixer(ALSA) or pamixer(PA)\""
+ command_toggle="i3-nagbar -m \"please install amixer(ALSA) or pamixer(PA)\""
+fi
+
+if [[ $1 =~ ^\+[0-9]$ ]]
+then
+ eval $command_inc "${1:1}$inc_suff"
+elif [[ $1 =~ ^\-[0-9]$ ]]
+then
+ eval $command_dec "${1:1}$dec_suff"
+elif [[ $1 = "toggle" ]]
+then
+ eval $command_toggle
+else
+ eval "i3-nagbar -m \"not supported command $1\""
+fi