Skip to content

Instantly share code, notes, and snippets.

@lawrencegripper
Created April 12, 2020 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lawrencegripper/12216b1f77c06dfaa981b4a555fb6008 to your computer and use it in GitHub Desktop.
Save lawrencegripper/12216b1f77c06dfaa981b4a555fb6008 to your computer and use it in GitHub Desktop.
Mute and unmute mic Ubuntu
#!/bin/bash
pacmd list-sources | \
grep -oP 'index: \d+' | \
awk '{ print $2 }' | \
xargs -I{} pactl set-source-mute {} toggle
MUTED=$(pacmd list-sources | grep "muted: no" | wc -l)
if (( $MUTED > 0 )); then
zenity --info --timeout=1 --title="Microphone" --text="Mic OFF" --width 600 --height 600
else
zenity --info --timeout=1 --title="Microphone" --text="Mic ON" --width 600 --height 600
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment