Mute Microphone/Speakers in Slack/Teams, Leave Meeting? (With Stream Deck)

Got my Stream Deck XL last week. Already enjoying it, but these things would help even more while working from home, due to COVID-19 measures:

  • mute microphone in Slack (and show the actual status)
  • mute speakers in Slack (and show the actual status)
  • leave a Slack meeting/huddle
  • mute microphone in Teams (and show the actual status)
  • mute speakers in Teams (and show the actual status)
  • leave a Teams meeting

I guess I’m not the first to want this.

Anyone already created/found such thing? (using Keyboard Maestro or something else)

I don't have Slack, or Teams, but I am going to ask you two questions:

  • Is Slack AppleScript enabled?
  • Does Slack have keyboard shortcuts for everything you want to do?

If so, there will be reliable answers. If not, there will still be answers, but more difficult ones.

Sleepy asked some very pointed questions that bear answering. If you can answer those we could likely come up with some answers for you.

Personally I don't use Slack or Teams, so I'm not to up to speed on them but for the microphone issue there's a company called MuteMe that makes a USB device that controls the microphone at the system level and also syncs that status to Teams and Slack (and other apps).

For the speakers, you could also look into SoundSource can control sound for each individual app and has icons in the menu bar to show their status (such as muted or not, current sound level).

I use MuteMe and SoundSource on a daily basis and have MuteMe buttons integrated into my Stream Deck. If you're interested in how I do this just let me know and I can provide more info.

-Chris

  • Have to admit I have never used AppleScript; how can I check whether Slack supports it?
  • Slack has a keyboard shortcut for muting (⌘⇧␣), but it overlaps with the 1Password 8 Quick Access shortcut (same one), so I was hoping I could do it some other way...

EDIT: Looks like the answer to the first question is "Yes"?

If you open the Script Editor app, and choose Open Dictionary from the File menu, you will see a Open Dictionary dialog window. Look for the Slack app in the list.

This Keyboard Maestro action should do what you want:

Screen Shot 2021-12-08 at 1.50.47pm

AppleScript is a nearly 100% reliable way to send commands to apps. But I'm not very good with it. Someone else, probably someone who has your app and knows AppleScript better than me, is better equipped to help you.

The second most reliable way is to send keys to the apps if the apps support keyboard shortcuts. You said they do, but you said they may overlap some shortcuts. Isn't there a way in the apps to change their shortcuts? That seems pretty lame if they can't adapt.

If neither of the above methods work, there're other ways, but let's stick to the reliable ways for now.

Unfortunately both Slack and Teams do not show up in that dialog (not really surprising since they're both Electron Apps?).

Hey Rob,

Just fyi – you can drag and drop apps to the Script Editor icon in Finder or the Dock, and this will open an app's sdef (scripting definition file or dictionary) if it has one.

Unfortunately that won't change your result in this case.

So far I've not seen an Electron app that is scriptable at all, although you'd think an AppleScript bridge to JavaScript in the app would allow for same.

If Shortcuts gains popularity, maybe well see E-apps get busy – but I'm not holding my breath.

-Chris

I would like that (I would keep the combo for 1Password and use a different one for Slack), but guess what?

1Password allows changes:
1Password

Slack does not:
Slack

That's good to see, (the screenshots) thanks.

I admit, I'm a little confused. Maybe I'm in over my head. But you seem to have two separate issues that you are trying to solve. One is getting these two apps to respond to your preferred keystrokes for certain functions, and the other is getting these apps to do certain things when they don't support AppleScript or have keystrokes for certain functions. Is that right?

Since you have shown that one of them has the ability to redefine keystrokes, you can remove any keystroke conflicts that way. You can also use KM to interpret user keystrokes any way you want, and you can map those to your apps any way you want. So I don't see an issue addressing this problem.

The remaining problem is getting the apps to do certain things when they don't have any keystrokes for those functions or AppleScript support. This can still be solved by using KM to send mouse clicks to the apps. Right? Is that your plan now? If this is correct, and if you want help writing a KM macro to click on things in the app, we can help with that.

But if I'm all wrong, I'll just slip into the woodwork quietly.

I’m going to try the keyboard shortcuts for now.

However, I still don’t know how to check the status (for example whether audio is muted or not).

For now I will assume the Apps always start with audio/camera on. Keys will then reflect the correct status if (and only if) I exclusively use my Stream Deck to change the status.

If there's a way to check the status using your eyeballs, then there's a way to check the status with KM, because KM can read the screen just like your eyeballs can. But I have never seen the screens that these apps create, so I can't directly help. I suppose I can search for clips on YouTube.

Yes and no.

Slack will show the status in its main window, but I usually have the (other) window of the Slack call maximised to see/read the code that we are pair programming.

When AppleScript and Application shortcuts both fail, as they do in this case, then you must create a macro that uses the screen, mouse and keyboard to solve the problem. You are saying that usually the information is hidden. Well, either your macro has to unhide the information briefly or you have no solution.

You have to be willing to get a macro to go through the exact same steps that you would do this manually with your eyes and fingers. If that involves clicking mouse on the screen, then sobeit. If you can't do it manually, then you can't do it with automation. If you can document how you do it manually, then you can write a KM macro to do it. So are you willing to go to the effort of documenting how you do it manually? The macro will replicate how you do it manually.

I'm happy to help if you document every step you take when you do this manually.

Thanks.

I started this topic to find out if I was unaware of alternative approaches, but if there are none (as it seems), I’m good with the macros (that simulate keyboard shortcuts) which I created yesterday. Let’s see how they work today.

If I have additional questions I’ll post them here.

Hi rob,
I can't help you with the StreamDeck issue, but going through the posts here solved my problem - how to ensure that no matter the window name of a meeting in Teams I'll achieve the mute/unmute. I think, that it was through the rabbit hole of the links with the github and applescript, but maybe you'll figure it out to combine withe the streamdeck and obviously just small edit for each application you need?

For Teams, I used to search for a window containing 'meeting' which was fine in my case for 70% of the cases, but 30% is quite a significant amount of manual work. Then I went to find an applescript which gets the microphone output to 0% and then set's it back to 100% or so... However this is also not helpful, as it seemed to misbehave with bluetooth headset, btw this lead me to find a freeware (MuteKey) which actually is also nice, but I hate the idea of using another app, when I was sure there's a way to achieve the desired result otherwise.

At the end 3 lines of AppleScript does the trick with combination of KM.
Hope you get it resolved also the way you want. In my case I hated that I couldn't get the MS Teams meeting/Call window to get muted no matter it's name, but yes... "the second window" seems to solve it!.

1 Like

Thank you for mentioning "activate the second window". Very interesting!

I have no experience with AppleScript, but am going to try this for Slack and Teams!

I have also no experience with AppleScript and I was very surprised when I saw this thing about the second window, as I've been searching for ways to activate the window with the ongoing meeting... I have tested it now for few days and it works flawlessly.
I haven't tried actually a state where I have multiple popped out windows like chats, planner, etc to see what's going to happen... but for my usage without pop-out windows is working just great.
For Slack.. I have no clue how it behaves, so good luck there :wink:
Cheers, Stan

With regards to your app not allowing you to make changes to the keyboard shortcuts, there is another way to do this that works for some applications.

If you go to System Preffs > Keyboard > Shortcuts > App Shortcuts then you can add custom ones for any of the items in the standard menu bar. You just press [+] to add the App, then enter the exact menu item name, followed by the new shortcut key.


In this example, I have changed the Print shortcut in Safari from Cmd+P to Shift+Cmd+P, so you may find that this works for your application as well.

Nice, but unfortunately I can’t use this, since Slack has no menu option for (un)muting.

It only has a button (icon) to click and a hardcoded keyboard shortcut :frowning: