I am running Pipewire with Wireplumber on Ubuntu 21.10. I would like to execute a script when any application starts recording (e.g. when I go into a meeting and the application opens the microphone) This is not just for Zoom, it should work with any application including browser-based. My use case is to turn on a light via OpenHAB when I'm in a meeting. At the moment we use Zoom, Gather, Slack and Discord, and who knows what in the future.
My thought was to monitor Pipewire/Wireplumber to see when an application opens a source stream, but I can't find how to hook that up. Any ideas?
Here's what I came up with, taking advantage of the fact that
pactl
also works with PipeWire: