From 3ed6dd158be6a97e9866ff0c00e38d92c9d1d96f Mon Sep 17 00:00:00 2001 From: Sheldon Lee Date: Wed, 21 Sep 2022 00:14:41 +0800 Subject: [PATCH] Use pactl to control muting/unmuting for compatibility. --- .config/scripts/wm/toggle-mic-notify | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.config/scripts/wm/toggle-mic-notify b/.config/scripts/wm/toggle-mic-notify index 7e996e7..b73201c 100755 --- a/.config/scripts/wm/toggle-mic-notify +++ b/.config/scripts/wm/toggle-mic-notify @@ -1,6 +1,7 @@ #!/bin/sh -amixer set Capture toggle @> /dev/null -str=$(grep '\[on\]\|\[off\]' <<< $(amixer get Capture) | awk '{print $5}') -echo $str -notify-send "Microphone: $str" +pactl set-source-mute @DEFAULT_SOURCE@ toggle +str=$(pactl get-source-mute @DEFAULT_SOURCE@| awk '{print $2}') + +[[ "$str" == "yes" ]] && notify-send "Microphone: off" +[[ "$str" == "no" ]] && notify-send "Microphone: on"