Muting a Microsoft Teams call

I'm writing a macro to mute/unmute myself in a Microsoft Teams call

  • Activate Microsoft Teams
  • Type shift-cmd-M

but Activate Microsoft Teams does not work the way I want, I would need the window with the "active call" to get the focus. I usually have multiple msteams windows with other chats plus the window with the actual call.

The shift-cmd-M to toggle mute/unmute only works if the focus is on the window for the call.

I tried the Bring xxx window to Front but it does seems to be a way to target the "active call", the title of the window does not have anything distinctive.

So any alternative? Or any alternative to simulate a mute microphone button? I have seen posts about setting Input Volume to 0 but that's is not really muting the microphone (it won't show that you are muted in MS Teams: no mute icon, etc).

I have used devices like the headset Jabra Evolve 65 that have a mute button (pressing volume down for to seconds) and that somehow send a signal to mute to MS Teams (since the mute icon appears in the call). So I suspect there must be a way to send a "mute" ?

I investigated a bit and it seems to me that MSTeams accepts the USB HID General Desktop (0x01) Call Toggle Mute (0xE1) but only from the USB audio devices in the call (MS Teams > Settings > Devices> Sync device buttons).

I think your best bet is to cycle through the windows using either button or image detection, activate the window with the match, then send the toggle command.

"Leave" is detected as a button, and I think that's unique to the call window:

Mute:Unmute Teams - Button.kmmacros (3.9 KB)


If that doesn't work reliably, try image detection. You'll have to set the image to match your Teams UI (and it won't work if you leave your pointer hovering over the "Leave" button):

Mute:Unmute Teams - Image.kmmacros (22.5 KB)


The "A button name matching ^Leave is enabled" condition did not work. I guess since Teams is not really a native application (I think is an Electron / Embrace Edge WebView2) then Keyboard Maestro does not really have access to the button names.

But the "image recognition" route worked fine, thanks. I ended up modifying your proposed macro like this:

Microsoft Teams Toggle Mute : Unmute.kmmacros (9.5 KB)

The changes are

  • activate microsoft teams first
  • use condition "The screen containes image in the front window

Yeah, it works fine on the "old" Teams but not on the new version. I've got two machines running different versions so will have to add the image detection as well as button check -- thanks for the heads up!