Skip to content

Instantly share code, notes, and snippets.

@alan-mushi
Created November 8, 2015 14:11
Show Gist options
  • Save alan-mushi/0949f12fd82bb042a02d to your computer and use it in GitHub Desktop.
Save alan-mushi/0949f12fd82bb042a02d to your computer and use it in GitHub Desktop.
This simple helper script toggle the mute attribute for a program in pulseaudio.
#!/bin/bash
# This simple helper script toggle the mute attribute for a program in pulseaudio.
PROG="Chromium"
all=$(pacmd list-sink-inputs | egrep -B 15 "client: [0-9]+ <${PROG}>" | sed -n '1p;8p')
index=${all:11:2} # get the index
muted=${all:22:3} # get 'yes' or 'no'
echo "[~] Pulseaudio on ${PROG}:"
echo -e "\tindex: ${index:-index not set}"
echo -e "\tmuted: ${muted:-muted not set}"
if [ "$muted" == "yes" ] ; then
echo "[*] ${PROG} is detected as mute, let's change that"
pacmd set-sink-input-mute $index false
else
echo "[-] ${PROG} not found or already unmuted"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment