mirror of
https://github.com/mr0xb/scripts.git
synced 2026-08-27 19:34:57 -04:00
24 lines
630 B
Shell
Executable file
24 lines
630 B
Shell
Executable file
#!/usr/bin/env bash
|
|
|
|
# Toggle microphone mute state using pactl (PulseAudio / PipeWire)
|
|
# Requires: pactl, notify-send
|
|
|
|
# Get default source (microphone)
|
|
SRC=$(pactl info | awk -F': ' '/Default Source/ { print $2 }')
|
|
|
|
if [[ -z "$SRC" ]]; then
|
|
notify-send "🎙️ Mic Toggle" "No microphone source found."
|
|
exit 1
|
|
fi
|
|
|
|
# Get current mute state: yes/no
|
|
STATE=$(pactl get-source-mute "$SRC" | awk '{print $2}')
|
|
|
|
if [[ "$STATE" == "yes" ]]; then
|
|
pactl set-source-mute "$SRC" 0
|
|
notify-send "🎙️ Microphone" "🔊 Unmuted"
|
|
else
|
|
pactl set-source-mute "$SRC" 1
|
|
notify-send "🎙️ Microphone" "🔇 Muted"
|
|
fi
|
|
|