summaryrefslogtreecommitdiff
path: root/polybar/scripts/mic-toggle.sh
diff options
context:
space:
mode:
authorDavid Moc <personal@cdatgoose.org>2026-05-24 11:48:07 +0200
committerDavid Moc <personal@cdatgoose.org>2026-05-24 11:48:07 +0200
commit5fb19f10389b70ee2389755106092a9ef6c64598 (patch)
tree969eb0466de581cb14aa09f751a95138620fc720 /polybar/scripts/mic-toggle.sh
Go
Diffstat (limited to 'polybar/scripts/mic-toggle.sh')
-rwxr-xr-xpolybar/scripts/mic-toggle.sh13
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