aboutsummaryrefslogtreecommitdiff
path: root/scripts/.local/bin/personal/bar/mute
blob: 834618a225c5009779ee94615076b8b7283508d5 (plain)
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
31
32
33
#!/bin/bash

SOURCE="alsa_input.usb-R__DE_Microphones_R__DE_NT-USB_Mini_610BAACA-00.mono-fallback"

if [[ "$1" == "shortstatus" ]]; then
  VOLUME="$(pactl get-source-volume "$SOURCE" | grep -o [0-9]*%)"

  if [[ "$VOLUME" == "0%" ]]; then
    echo "Muted"
  else
    echo ""
  fi

  exit
fi

if [[ "$1" == "status" ]]; then
  NAME="$(pactl list sources | grep -o Description:.* | sed -n 's/Description: //g;2p')"
  VOLUME="$(pactl get-source-volume "$SOURCE" | grep -o [0-9]*%)"

  echo "$NAME ($VOLUME)"

  exit
fi

if [[ "$(pactl get-source-volume $SOURCE | grep -o [0-9]*%)" == "0%" ]]; then
  pactl set-source-volume "$SOURCE" 70%
  notify-send -u low "Unmuted" -r 110
else
  pactl set-source-volume "$SOURCE" 0%
  notify-send -u low "Muted" -r 110
fi