MUTE FIREFOX FROM COMMANDLINE USING PIPEWIRE
2023 October 04 | CommentsI watch Twitch a lot, it’s like my background noise like other people listen to radio or podcasts or whatever. And Twitch has ads. Seriously loud and extremely annoying ads. Like everything else these days it seems. I also don’t want to block them, as I like to think that they generate some revenue for the streamers I watch. So I mute Firefox when the ad bloc plays. So far, I did it by either muting the whole system with my keyboard’s mute button, or pressing Ctrl-M on the Firefox tab. The latter would of course need me to focus on Firefox and have the tab active, which is not always the case. Muting the whole system also has the disadvantage that I don’t hear other notifications which I do want.
So I came up with a small shellscript that uses pacmd with Pipewire to mute all sinks from Firefox and created a shortcut to run this script when I press Ctrl-Mute on my keyboard.
#!/bin/bash
for id in $( pactl list sink-inputs | perl -ne '/^Sink Input #(\d+)/ && { $sourceid=$1 }; /^\s+application.name = \"Firefox\"/ && print "$sourceid\n";' ); do
pactl set-sink-input-mute "${id}" toggle
done
EOF
Category: blog
Comments
You can use a Mastodon account to comment on this article by replying to the associated Mastodon toot.