With the onset of the COVID-19 pandemic, I shifted to a hybrid/remote work setup. With it came more frequent online meetings, and the need to toggle my microphone at a moment's notice.
I longed for a life free of fumbling through multiple desktops, windows and tabs in an effort to unmute myself when a question was directed to me during a meeting — a situation I often find myself in since I prefer working on a single display.
If your primary meeting platform is Slack, you have access to a handy shortcut for toggling your microphone:
Space. This works even if the Slack app is not in focus. But it does require the Slack app to be installed. If you're using Slack via a browser, then that tab must be in focus for the shortcut to work.
In my case I moved away from installing dedicated apps for each instant messaging platform I use, and instead migrated them to permanent tabs in my browser1. A significant portion of my meetings also took place over Microsoft Teams, so having a shortcut work for Slack but not Teams — or any other app — was far from ideal.
After some searching around, I came across this article describing how to mute the microphone on macOS. I set up the applescript2 as described and hooked it up so that it triggers when I press a keyboard shortcut.
The one thing missing though, was visual feedback to indicate what state the microphone is in. Applescript can trigger macOS notifications, so I modified the script to do just that each time it runs:
on getMicrophoneVolume() input volume of (get volume settings) end getMicrophoneVolume on disableMicrophone() set volume input volume 0 display notification "microphone is off" with title "🙊" end disableMicrophone on enableMicrophone() set volume input volume 100 display notification "microphone is on" with title "🎤" end enableMicrophone if getMicrophoneVolume() is greater than 0 then disableMicrophone() else enableMicrophone() end if
The downside, however, is a clogged up notification center. It's not very worthwhile knowing that I unmuted my microphone at 16:55. Clearing out the notifications felt like a chore.
After clearing my notifications hundreds of times over several months, I'd finally had enough. I set out to find a less mildly annoying solution. My initial research uncovered this Raycast plugin3. It met the 2 hard requirements that I wanted in a solution:
- a keyboard shortcut to toggle the mic
- a visual indication of whether the microphone is muted (in the form of a menubar icon)
However, I experienced one slightly jarring issue whenever I toggled the microphone using a keyboard shortcut: the microphone icon would briefly disappear along with all menubar icons to its left. They would then all rerender.
This was enough to push me to look into writing my own app4 to toggle the microphone without causing the menubar to flash. It also doubled as a nice first project to learn Swift. The source code is available in all its warts and glory.
I plan to add more features to make the app more usable, such as:
- Ability to start the app on login
- Ability to customise the keyboard shortcut
- Ability to remember the input level (currently, unmuting the microphone sets the input level to the maximum value of 100)
Given I'm an avid Raycast user, I was absolutely thrilled to discover this plugin just a day after it was published. ↩︎
As is the way with life, while doing some research for this article, I came across a number of free menu bar apps that cover the exact same functionality (and more) such as Mic Müter and Mute Key 🙃 ↩︎