Here's a tool I put together this evening.
**The Problem**
Sometimes I'm on a #Zoom call and need to unmute my mic quickly. There's a keystroke for this (by default Alt-A), but this only works if Zoom has focus. It's not uncommon for me to have switched to the PDF or email we're discussing, so I have to dig up Zoom before I can unmute and chime in, often missing the conversational opportunity.
**The Solution**
I wrote a script that:
1. checks if any audio streams are going into Zoom, otherwise quits
2. finds the numerical ID of the audio stream going into Zoom
3. toggles the mute flag on said audio stream
I bound it to the keystroke Control-Alt-A in my desktop environment, so I can easily toggle the mute no matter what application has focus.
**The Dependencies**
This is written in #Bash for #Linux systems using #PulseAudio and depends on its control tool `pactl` being installed.
**The Code**
```
#!/bin/bash
```
```
PASOPS=$(pactl list source-outputs)
```
```
if echo "$PASOPS" | grep -q 'ZOOM VoiceEngine' ; then
```
```
SOPID=$(echo "$PASOPS" | head -n $(($(echo "$PASOPS" | grep -n -e 'application.name = "ZOOM VoiceEngine"' | cut -f1 -d:) - 1)) - | grep -o -e 'Source Output #[0-9]\+' | grep -o -e '[0-9]\+' | tail -n 1);
```
```
pactl set-source-output-mute $SOPID toggle; fi
```
@Diptchip I'm using a Bluetooth headset, which has controls for the sink audio (played through earpieces) but not the source (recorded from mic). I could maybe crack it open and solder a switch in series with the mic; but, no, that wouldn't be easier.
Yes I run Zoom on Linux - Linux has been my daily driver for about ten years, and I don't get to dictate what communications tool we use.