I'm developing an Ubuntu AppIndicator in Python that shows the microphone current status (muted / On).
I'm able to mute/unmute the microphone in my Python script, but I also need to listen to Linux event in order to update the Indicator icon when the microphone is muted outside my application (for example, in Ubuntu Sound settings).
I know I could poll the mic state, but I'd like to implement it in a passive / reactive way.
Is there a way to listen to "microphone muted" event on Linux?
One way would be to poll the state using pacmd:
pacmd list-sinks | grep muted
This is wrapped in a library called pulsectl if you're using pulseaudio.