diff options
Diffstat (limited to 'polybar/scripts/mic-toggle.sh')
| -rwxr-xr-x | polybar/scripts/mic-toggle.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/polybar/scripts/mic-toggle.sh b/polybar/scripts/mic-toggle.sh new file mode 100755 index 0000000..de93cf6 --- /dev/null +++ b/polybar/scripts/mic-toggle.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euo pipefail + +if ! command -v pactl >/dev/null 2>&1; then + exit 0 +fi + +pactl set-source-mute @DEFAULT_SOURCE@ toggle + +if command -v dunstify >/dev/null 2>&1; then + status="$(pactl get-source-mute @DEFAULT_SOURCE@ 2>/dev/null | awk '{ print $2 }' || true)" + dunstify -a polybar -u low "Microphone" "${status:-toggled}" +fi |
