Muting and unmuting Zoom from anywhere on the linux desktop

As far as I know, the linux zoom client doesn't have a globally-accessible mute shortcut. The shortcut for muting and unmuting when the meeting window is in focus, Alt+a, isn't very convenient either.

Until today, my UX for (un)muting myself in zoom was:

  1. Alt-tab frantically to find the zoom meeting window
  2. Press Alt+a
  3. Alt-tab back to where I was.

I realized that this deficiency can be "automated around" using the wonderful xdotool. Here's the script that I bound to a keyboard shortcut using my window manager:

#!/bin/sh
CURRENT=$(xdotool getwindowfocus)
ZOOM=$(xdotool search --limit 1 --name "Zoom Meeting ID:")
xdotool windowactivate --sync ${ZOOM}
xdotool key --clearmodifiers "alt+a"
xdotool windowactivate --sync ${CURRENT}

This essentially does what I used to do by hand, except much faster & with less distraction.

One thing to note: at least on my machine, the Alt+a shortcut does not work when I'm the person screen-sharing during the call. The only way to mute in that situation is to hover to the top of the (shared) screen, wait for the call controls to graciously appear, and click the Mute/Unmute button.