aboutsummaryrefslogtreecommitdiff
path: root/scripts/sound.sh
blob: cda805a8784f1f5e941d2864dbd49b7bd5330f06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash

mic_keep_on() {
  while true; do
    local audio_state=$(amixer get Capture | awk "/: Capture.*\[/ {print \$7}" | head -n 1);
    [[ "$audio_state" != "[on]" ]] && amixer set Capture cap;
    sleep 1;
  done;
}

case "$1" in
  mute-mic) amixer set Capture toggle ;;
  mic-keep-on) mic_keep_on ;;
  mic-vol) case "$2" in
    up) amixer sset 'Mic Boost' '1%+' && amixer sset 'Internal Mic Boost' '1%+' ;;
    down) amixer sset 'Mic Boost' '1%-' && amixer sset 'Internal Mic Boost' '1%-' ;;
    full) amixer sset 'Mic Boost' '100%' && amixer sset 'Internal Mic Boost' '100%' ;;
  esac ;;

  mute) amixer set Master toggle ;;
  volume) case "$2" in
    up) amixer sset Master '5%+' ;;
    down) amixer sset Master '5%-' ;;
    perc) amixer sset Master "$3%" ;;
  esac ;;
  *) echo "Wrong command" ;;
esac

#~/scripts/statusbar/statusbar.sh update volume;
update-dwmblock volume;