Created
November 8, 2015 14:11
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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