#!/bin/bash # pw-mute-window 0.3: 2025 Christian Birchinger # # Mute the active (X11) window applications incl. terminal programs with Pipewire. # Mostly usefull as a global hotkey. The initial idea was to do this for sink # switching, but wpcli or similar tools don't have this option for PIDs, so more # manual pw-dump and json magic would be required. # function getchilds() { cpids=$(pgrep -P "$1" | xargs) for cpid in ${cpids}; do echo "$cpid" ${FUNCNAME[0]} "${cpid}" done } wpid=$(xdotool getactivewindow getwindowpid) for p in ${wpid} $(getchilds "${wpid}"); do wpctl set-mute --pid "${p}" toggle done