Send shortcut to specific app (Microsoft Teams) action not working when app is on the foreground

Describe the bug
So, I may have found a very specific bug with the send shortcut to specific app action.

I'm trying to set up a global shortcut to mute/unmute Microsoft Teams even when I'm not viewing the app.

My trigger and action are defined as follows (note that I've checked "differentiate left/right modifier keys") so that when I press "right option + M", it should send "cmd+shift+M" to the Teams app. Quick note here: I've configured BTT in a way that maps my caps-lock key to right option and have been successfully using it as kind of a hyper key.

This action works perfectly fine if Teams is not on the foreground. However, when it is, the microphone is not being muted/unmuted even though I'm sure the action is being executed since the HUD overlay is being shown.

I've also verified that everything works if I uncheck the "differentiate left/right modifier keys" AND use the left option key. It still doesn't work with the right option key β€” in this case, caps lock.

Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):
Keyboard

Device information:

  • Type of Mac: iMac (Retina 4K, 21.5-inch, 2017)
  • macOS version: MacOS Big Sur Beta 11.2
  • BetterTouchTool version: 3.505 (1643)

Did you ever figure this out?. One thing I noticed when trying to set up a global mute for Teams is that the mute command only works if your meeting window is active and not the chat window which is hard to predict because its whichever is last, so i wonder if that was what was going on.

I'm trying to do a mute/unmute ALL videoconferencing platforms.
Webex and Zoom have 'universal' shortcuts, teams doesn't
so sending the sequence to ALL + Teams cancels out and nothing happens when in foreground, but works in background.
likely going to have to do some scripting.

I was able to solve this using AppleScript! It's been working very well so far, both with Teams running in the foreground and in the background. If I'm on a different space, it does switch to the Teams window though.

Action: Run Apple Script (blocking)

on run
	
	tell application "Microsoft Teams (work or school)"
		activate
		tell application "System Events"
			keystroke "m" using {shift down, command down}
		end tell
	end tell
	
	return input
end run
1 Like

This one worked beautifully! I did have to add it under All Apps, rather than specific under the "MS Teams" app.

I also ran into this bug. In my case I have β‡ͺ as hyper key set to right β‡§βŒƒβŒ₯⌘. It works in all other applications, but not for sending shortcuts to Teams. If I skip the hyper key and just use ⌘X to send ⌘Y it works, but using the hyper key doesn't. It doesn't matter if I just send the plain key, or if I send it specifically to Teams. Other actions work: I can use hyper key triggers for menu bar or context menu items, just not with shortcut key actions. It seems Teams somehow sense that there are other modifiers active, and thus mis-interpret whatever key I'm trying to send.

My solution was to add a small delay at the beginning (long enough for me to be able to release my fingers from the keyboard before the shortcut is fired), and then send the shortcut specifically to Teams.

@Andreas: I did some testing which might help you identify the issue:

Only some shortcut keys are affected. If the destination action is ⌘V, it always works. If the destination action is ⌘N, some modifier combinations don't work. I tested all possible modifier combinations in the trigger (with the action set to ⌘N), and here is the result:

Executive summary reveals two problems:

  1. Any combinations with any option key while differentiating left/right modifiers requires repeated presses (or a delay before the action).
  2. All four modifiers without differentiating never works. Unless you create the trigger using the hyper key - in which case it always works if you press the actual four keys without differentiating left/right - but not if you press the hyper key (in which case it needs repeated presses).

One modifier:
⇧, βŒƒ, βŒ₯, ⌘: Always work.
Two modifiers:
β‡§βŒƒ, ⇧βŒ₯, β‡§βŒ˜, βŒƒβŒ₯, βŒƒβŒ˜, βŒ₯⌘: Always work.
Three modifiers:
β‡§βŒƒβŒ₯, β‡§βŒƒβŒ˜, ⇧βŒ₯⌘, βŒƒβŒ₯⌘: Always work.
Four modifiers (using the actual keys and not the hyper key to create the trigger):
β‡§βŒƒβŒ₯⌘: Never works.

Differentiating left/right:
One modifier:
βŒ˜β†’, βŒ₯β†’, ⇧→: Always work
Two modifiers:
β†β‡§βŒ˜β†’, β†βŒƒβŒ˜β†’, ←⇧⇧→, β†βŒƒβ‡§β†’, β†βŒ˜β‡§β†’, βŒ˜β†’β‡§β†’: Always work.
←⇧βŒ₯β†’, β†βŒƒβŒ₯β†’, ←βŒ₯βŒ₯β†’, β†βŒ˜βŒ₯β†’, βŒ₯β†’βŒ˜β†’, ←βŒ₯βŒ˜β†’, ←βŒ₯⇧→, βŒ₯→⇧→: Work if I press it repeatedly. Takes 3-5 tries. Never work on the first try. Common denominator: Left or right option key.
β†βŒ˜βŒ˜β†’: Not possible to use as a trigger (doesn't register).
Three modifiers:
β†β‡§β†βŒƒβŒ˜β†’, β†β‡§β†βŒƒβ‡§β†’, β†β‡§β†βŒ˜β‡§β†’, β†β‡§βŒ˜β†’β‡§β†’, β†βŒƒβ†βŒ˜β‡§β†’, β†βŒƒβŒ˜β†’β‡§β†’: Always work.
←⇧←βŒ₯βŒ˜β†’, ←⇧←βŒ₯βŒ₯β†’, β†β‡§β†βŒ˜βŒ₯β†’, β†β‡§βŒ˜β†’βŒ₯β†’, β†βŒƒβ†βŒ₯βŒ˜β†’, β†βŒƒβ†βŒ₯βŒ₯β†’, β†βŒƒβ†βŒ˜βŒ₯β†’, ←βŒ₯β†βŒ˜βŒ₯β†’, ←⇧←βŒ₯⇧→, ←⇧βŒ₯→⇧→, ←⇧←βŒ₯⇧→, ←⇧βŒ₯→⇧→, β†βŒƒβ†βŒ₯⇧→, β†βŒƒβŒ₯→⇧→, ←βŒ₯β†βŒ˜β‡§β†’, ←βŒ₯βŒ˜β†’β‡§β†’, ←βŒ₯βŒ₯→⇧→, βŒ˜β†’βŒ₯→⇧→: Needs repeated presses. Again, all with left and/or right option key.
β†β‡§β†βŒ˜βŒ˜β†’, β†βŒƒβ†βŒ˜βŒ˜β†’, ←βŒ₯β†βŒ˜βŒ˜β†’, β†βŒ˜βŒ˜β†’βŒ₯β†’, β†βŒ˜βŒ˜β†’β‡§β†’: Not possible.
Four modifiers:
β†β‡§β†βŒƒβ†βŒ˜β‡§β†’, β†β‡§β†βŒƒβŒ˜β†’β‡§β†’: Always work.
β†β‡§β†βŒƒβ†βŒ₯βŒ˜β†’, β†β‡§β†βŒƒβ†βŒ₯βŒ₯β†’, β†β‡§β†βŒƒβ†βŒ₯⇧→, β†β‡§β†βŒƒβ†βŒ˜βŒ₯β†’, β†β‡§β†βŒƒβŒ˜β†’βŒ₯β†’, β†β‡§β†βŒƒβŒ˜β†’β‡§β†’, ←⇧←βŒ₯β†βŒ˜βŒ₯β†’, β†βŒƒβ†βŒ₯β†βŒ˜βŒ₯β†’, β†βŒƒβ†βŒ₯β†βŒ˜β‡§β†’, β†βŒƒβ†βŒ₯βŒ˜β†’βŒ₯β†’, β†βŒƒβ†βŒ₯βŒ˜β†’β‡§β†’, β†βŒƒβ†βŒ₯βŒ₯→⇧→, β†βŒƒβ†βŒ˜βŒ₯→⇧→, β†βŒƒβŒ˜β†’βŒ₯→⇧→: Needs repeated presses.
β†β‡§β†βŒƒβ†βŒ˜βŒ˜β†’, ←⇧←βŒ₯β†βŒ˜βŒ˜β†’, β†β‡§β†βŒ˜βŒ˜β†’βŒ₯β†’, β†β‡§β†βŒ˜βŒ˜β†’β‡§β†’, β†βŒƒβ†βŒ₯β†βŒ˜βŒ˜β†’, β†βŒƒβ†βŒ˜βŒ˜β†’βŒ₯β†’, β†βŒƒβ†βŒ˜βŒ˜β†’β‡§β†’, ←βŒ₯β†βŒ˜βŒ˜β†’βŒ₯β†’, ←βŒ₯β†βŒ˜βŒ˜β†’β‡§β†’, β†βŒ˜βŒ˜β†’βŒ₯→⇧→: Not possible.

Using hyper key (Caps Lock as β‡§βŒƒβŒ₯⌘, all right keys) to create the trigger:
Without differentiatng between left/right:
β‡§βŒƒβŒ₯⌘: Now always work, which is very peculiar, since it never works if I use the same actual four keys to create the trigger.
β‡ͺ: Needs repeated presses.
With differentiating between left/right:
β‡ͺ: Needs repeated presses.

Note: I can't test β‡§β†’βŒƒβ†’βŒ₯β†’βŒ˜β†’ or any other combination using the right control key, since my keyboard doesn't have a right control key.

Note: If you add a delay before the shortcut key and release the fingers from the keyboard before the action fires, all of the above works fine.

Realized that my list was a bit chaotic, so here is a table instead:

Always, Repeated and Impossible.

⇧ βŒƒ βŒ₯ ⌘ βŒ˜β†’ βŒ₯β†’ ⇧→ β‡§βŒƒ ⇧βŒ₯ β‡§βŒ˜ β‡§βŒ˜β†’ ⇧βŒ₯β†’ ⇧⇧→ βŒƒβŒ₯ βŒƒβŒ˜ βŒƒβŒ˜β†’ βŒƒβŒ₯β†’ βŒƒβ‡§β†’ βŒ₯⌘ βŒ₯βŒ˜β†’ βŒ₯βŒ₯β†’ βŒ₯⇧→ βŒ˜βŒ˜β†’ ⌘βŒ₯β†’ βŒ˜β‡§β†’ βŒ˜β†’βŒ₯β†’ βŒ˜β†’β‡§β†’ βŒ₯→⇧→
A A A A A A A A A A A A R A A A A R A A R R R I R A R A R
⇧ A A A R A A R R R I R A R A R ⇧
βŒƒ A R R R I R A R A R βŒƒ
βŒ₯ I R R R R R βŒ₯
⌘ I I R ⌘
βŒ˜β†’ R βŒ˜β†’
βŒ₯β†’ βŒ₯β†’
⇧→ ⇧→
β‡§βŒƒ N R R R I R A R A R β‡§βŒƒ
⇧βŒ₯ i R R R R R ⇧βŒ₯
β‡§βŒ˜ I I R β‡§βŒ˜
β‡§βŒ˜β†’ R β‡§βŒ˜β†’
⇧βŒ₯β†’ ⇧βŒ₯β†’
⇧⇧→ ⇧⇧→
βŒƒβŒ₯ I R R R R R βŒƒβŒ₯
βŒƒβŒ˜ I I R βŒƒβŒ˜
βŒƒβŒ˜β†’ R βŒƒβŒ˜β†’
βŒƒβŒ₯β†’ βŒƒβŒ₯β†’
βŒƒβ‡§β†’ βŒƒβ‡§β†’
βŒ₯⌘ I I R βŒ₯⌘
βŒ₯βŒ˜β†’ R βŒ₯βŒ˜β†’
βŒ₯βŒ₯β†’ βŒ₯βŒ₯β†’
βŒ₯⇧→ βŒ₯⇧→
βŒ˜βŒ˜β†’ I βŒ˜βŒ˜β†’
⌘βŒ₯β†’ ⌘βŒ₯β†’
βŒ˜β‡§β†’ βŒ˜β‡§β†’
βŒ˜β†’βŒ₯β†’ βŒ˜β†’βŒ₯β†’
βŒ˜β†’β‡§β†’ βŒ˜β†’β‡§β†’
βŒ₯→⇧→ βŒ₯→⇧→
⇧ βŒƒ βŒ₯ ⌘ βŒ˜β†’ βŒ₯β†’ ⇧→ β‡§βŒƒ ⇧βŒ₯ β‡§βŒ˜ β‡§βŒ˜β†’ ⇧βŒ₯β†’ ⇧⇧→ βŒƒβŒ₯ βŒƒβŒ˜ βŒƒβŒ˜β†’ βŒƒβŒ₯β†’ βŒƒβ‡§β†’ βŒ₯⌘ βŒ₯βŒ˜β†’ βŒ₯βŒ₯β†’ βŒ₯⇧→ βŒ˜βŒ˜β†’ ⌘βŒ₯β†’ βŒ˜β‡§β†’ βŒ˜β†’βŒ₯β†’ βŒ˜β†’β‡§β†’ βŒ₯→⇧→

Somewhat related - if Teams is in focus but the meeting window is NOT (aka, you have a running meeting on another screen/window but are currently in a private chat focus with a DM), the shortcut sent to Teams will not work. It not only needs to get sent to the active APP, but to the correct WINDOW in that app, which BTT can’t really do I think.

you can probably use the "Activate Specific Window" action if the window is somehow identifiable (e.g. via title)

1 Like

Ah true. For me though I’d like to avoid switching over to a full screen window to unmute while chatting in the main teams window. My workaround is to click the MuteMe global mute shortcut on my menu bar, but this doesn’t work because I am using Teams in fullscreen mode (both chat and meeting windows), so I am trying to come up with another way. Thanks.