diff --git a/dotfiles/lib/bin/mute_current_window.sh b/dotfiles/lib/bin/mute_current_window.sh index 46fb96da..dbd2c224 100755 --- a/dotfiles/lib/bin/mute_current_window.sh +++ b/dotfiles/lib/bin/mute_current_window.sh @@ -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" -pactl set-sink-input-mute "$sinkID" "$newState" +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