Permalink
Browse files

Merge pull request #3 from Louson/master

Manage the mic mute with 'micmute'
  • Loading branch information...
boredomwontgetus committed Apr 16, 2018
2 parents 50510d3 + e405aaa commit 2530d3626b312f019f14af35f51acd90a59cec31
Showing with 11 additions and 2 deletions.
  1. +11 −2 pa-vol.sh
@@ -9,7 +9,8 @@
SINK_NAME=$(pacmd dump | perl -a -n -e 'print $F[1] if /set-default-sink/')
# try this line instead of the one above if you got problems with the detection of your default sink.
#SINK_NAME=$(pactl stat | grep "alsa_output" | perl -a -n -e 'print $F[2]')
SOURCE_NAME=$(pacmd dump | perl -a -n -e 'print $F[1] if /set-default-source/')
# set max allowed volume; 0x10000 = 100%
VOL_MAX="0x10000"
@@ -18,6 +19,7 @@ VOL_STEP=$((VOL_MAX / STEPS))
VOL_NOW=`pacmd dump | grep -P "^set-sink-volume $SINK_NAME\s+" | perl -p -n -e 's/.+\s(.x.+)$/$1/'`
MUTE_STATE=`pacmd dump | grep -P "^set-sink-mute $SINK_NAME\s+" | perl -p -n -e 's/.+\s(yes|no)$/$1/'`
MIC_MUTE_STATE=`pacmd dump | grep -P "^set-source-mute $SINK_NAME\s+" | perl -p -n -e 's/.+\s(yes|no)$/$1/'`
function plus() {
VOL_NEW=$((VOL_NOW + VOL_STEP))
@@ -38,7 +40,11 @@ function minus() {
function mute() {
pactl set-sink-mute $SINK_NAME toggle
}
function micmute() {
pactl set-source-mute $SOURCE_NAME toggle
}
function get() {
BAR=""
if [ $MUTE_STATE = yes ]; then
@@ -76,4 +82,7 @@ case "$1" in
;;
get)
get
;;
micmute)
micmute
esac

0 comments on commit 2530d36

Please sign in to comment.