Adding a keyboard command to mute and unmute Zoom with macOS and Alfred
I often find myself on a Zoom meeting, on mute, and quickly need to unmute myself to respond to something.
But the Zoom window is not always the one that’s currently active on my desktop, so I find myself frantically hunting for it and trying to click the unmute button so I can respond before the moment of awkward silence drags on too long.
I’m also a heavy user of Alfred for macOS, and pay for the Powerpack upgrade.
So, this week, I added a few Alfred commands to mute and unmute Zoom calls, and wanted to show you how.
A few things of note
Items one and two conflict with each other. Sorry!
- For this to work, you need to Powerpack upgrade for Alfred. This trick uses Workflows, which are a paid upgrade.
- If you’re comfortable creating a macOS Applescript with Automator, you technically don’t need Alfred at all. You can map what I’m about to show you to an Applescript and run it with keyboard commands (more on that later).
- There are a handful of tutorials on the web about how to toggle mute in Zoom. I wanted to explicitly mute or unmute without having to look at Zoom to know which one happened, so I broke them out into two separate commands.
Alright, let’s dig in!
Creating an Alfred workflow to mute Zoom
First, open up Alfred’s preferences panel. Then, click on the “Workflows” tab.
Click the little +
button in the bottom left-hand corner, then select Templates > Essentials > Keyword to Applescript. Name it “Mute Zoom,” and give it a description and category if you want. Then click Create.
A new workflow should now be in your Workflows.
Double click on the Keyword block. Under Keyword, write mute-zoom
. Under Title, write Mute Zoom
. Then click Save.
Next, double click on the Run NSAppleScript block. Under AppleScript, delete the code that’s already there, then copy/paste the following code into the field and click Save.
on alfred_script(q)
tell application "System Events"
if exists window 1 of process "zoom.us" then
tell application process "zoom.us"
if exists (menu 1 of menu bar item "Meeting" of menu bar 1) then
set meetingMenu to menu 1 of menu bar item "Meeting" of menu bar 1
set canMute to exists menu item "Mute audio" of meetingMenu
if canMute then
click menu item "Mute audio" of meetingMenu
end if
end if
end tell
end if
end tell
end alfred_script
Now, you can mute a Zoom call by typing mute-zoom
or Mute Zoom
in Alfred’s command prompt.
Creating an Alfred workflow to unmute Zoom
Let’s create a second Workflow to unmute Zoom.
Right-click the Workflow you just created and click Duplicate. Double click the Workflow, then update the Name and Description to reflect that this unmutes Zoom.
Next, Double click on the Keyword block. Edit the Keyword field to say unmute-zoom
, and the Title field to say Unmute Zoom
. Then click Save.
Double click on the Run NSAppleScript block. Under AppleScript, delete the code that’s already there, then copy/paste the following code into the field and click Save.
on alfred_script(q)
tell application "System Events"
if exists window 1 of process "zoom.us" then
tell application process "zoom.us"
if exists (menu 1 of menu bar item "Meeting" of menu bar 1) then
set meetingMenu to menu 1 of menu bar item "Meeting" of menu bar 1
set canUnmute to exists menu item "Unmute audio" of meetingMenu
if canUnmute then
click menu item "Unmute audio" of meetingMenu
end if
end if
end tell
end if
end tell
end alfred_script
Now, you can unmute a Zoom call by typing unmute-zoom
or Unmute Zoom
in Alfred’s command prompt.
Doing this without Alfred
I mentioned that you technically don’t need Alfred at all to do this. Here’s how…
- Open the Automator app.
- Select “New Document” or go to File > New, then select “Quick Action.”
- Under Workflow receives, select “no input.”
- Drag-and-drop Run AppleScript from the left-hand menu into the “Drag actions here” section.
- Copy/paste the Mute snippet from above without the leading
on alfred_script(q)
or endingend alfred_script
commands. - Select File > Save, and save it as “Mute Zoom.”
- Repeat this process using the Unmute snippet, and name it “Unmute Zoom.”
Now, you have to AppleScripts that will mute and unmute Zoom, respectively. Next, you need to map them to keyboard shortcuts.
- Go to your Apple System Preferences, and select Keyboard.
- Click the “Shortcuts” tab.
- Select “Services” from the left-hand menu.
- Under “General,” you should see your two new AppleScripts. Click the right-hand column for each one to map a keyboard shortcut to each script.
Note: these will be universal and overwrite any app-specific keyboard commands.