summaryrefslogtreecommitdiffstats
path: root/toggle-pulseaudio-mic-mute
blob: d96b599c69cff81fe8da6476636b399c78f8e6f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

target_value=$(if [[ $(pactl get-source-mute '@DEFAULT_SOURCE@' | sed 's/Mute: //') == "yes" ]]; then echo "no"; else echo "yes"; fi)

pacmd list-sources |  grep -oP 'index: \d+' | awk '{ print $2 }' | xargs -I{} pactl set-source-mute {} "$target_value"


notify_opts=()
if [[ "$target_value" = "yes" ]]; then
	notify_opts=(-h "string:bgcolor:#ff0000" -h "string:fgcolor:#000000")
else
	notify_opts=(-h "string:bgcolor:#00ff00" -h "string:fgcolor:#000000")
fi

notify-send "${notify_opts[@]}" -h string:x-canonical-private-synchronous:"${0##*/}" -t 3000 "Microphone mute: $target_value"