[Linux] Support muting and unmuting exactly one source

This commit is contained in:
Ivan Malison 2017-04-06 22:26:26 -07:00
parent 0cbb943629
commit ba1dea3668
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -1,5 +1,9 @@
#!/usr/bin/env zsh
otherinputs () {
get_sink_input_info.hs | jq 'select(.application_process_id != "'"$1"'")'
}
thePID="$(xprop _NET_WM_PID -id $(xdotool getactivewindow) | grep -Eo '[0-9]*')"
sinkInfo="$(pashowinputbypid $thePID)"
sinkID="$(echo $sinkInfo | jq -r .sink_input_id)"
@ -12,4 +16,9 @@ fi
echo "$sinkID"
if [[ $1 == *"only"* ]]; then
pactl set-sink-input-mute "$sinkID" 0
otherinputs "$thePID" | jq -r .sink_input_id | xargs -I theid sh -c 'pactl set-sink-input-mute theid 1'
else
pactl set-sink-input-mute "$sinkID" "$newState"
fi