Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Main/Microsoft Teams/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Microsoft Teams Remote

Basic remote to control Microsoft Teams app on macOS.

Uses AppleScript to trigger appropriate keyboard shortcuts.

Detection of current microphone mute state is based on Touch Bar button description,
so if for Macs without it You'll have to come up with something else
(so far I didn't find any other way – no corresponding message in log when mute is toggled,
the window itself is not Cocoa so no access to its elements either).
Toggling works though.
Binary file added Main/Microsoft Teams/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Main/Microsoft Teams/icon_hires.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions Main/Microsoft Teams/layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layout>
<row>
<label id="isMuted" text="Mute state unknown (click to refresh)" onTap="getIsMuted" color="normal" />
</row>
<row>
<button text="Toggle mute" ontap="toggleMute" />
</row>
<row>
<button text="Accept Audio Call" ontap="acceptAudioCall" />
</row>
<row>
<button text="Decline Call" ontap="declineCall" />
</row>
<row>
<button text="Leave Call" ontap="leaveCall" color="red" />
</row>
</layout>
5 changes: 5 additions & 0 deletions Main/Microsoft Teams/meta.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
meta.name: MS Teams
meta.author: wadimw
meta.description: Remote MS Teams actions for MacOS
meta.tags: util
meta.platform: mac
88 changes: 88 additions & 0 deletions Main/Microsoft Teams/remote.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
local script = libs.script;

--@help Mute mic
actions.toggleMute = function ()
script.apple(
"set lastActiveApp to (path to frontmost application as text)", -- save to switch back later
"tell application \"Microsoft Teams\" to activate",
"tell application \"System Events\" to tell process \"Microsoft Teams\"",
"beep",
"keystroke \"m\" using {command down, shift down}",
"end tell",
"tell application lastActiveApp to activate")
actions.getIsMuted()
end

actions.getIsMuted = function ()
out,err,res = script.apple(
-- focus out of Teams and then back in to trigger refresh of Touch Bar content
"set lastActiveApp to (path to frontmost application as text)",
"if lastActiveApp is equal to (path to application \"Microsoft Teams\" as text) then",
"tell application \"Finder\" to activate",
"else",
"tell application lastActiveApp to activate",
"end if",
"delay 1",
"tell application \"Microsoft Teams\" to activate",
-- read current mute state from description of Touch Bar mute/unmute button
"tell application \"System Events\" to tell process \"Microsoft Teams\"",
"if not (exists (first UI element whose role is \"AXFunctionRowTopLevelElement\")) then",
"set out to \"Mute state unknown (Touch Bar unavailable)\"",
"else",
"tell (first UI element whose role is \"AXFunctionRowTopLevelElement\")",
"if exists (first button whose description starts with \"Unmute\") then",
"set out to \"Muted\"",
"else if exists (first button whose description starts with \"Mute\") then",
"set out to \"Unmuted\"",
"else",
"set out to \"Mute state unknown (not in call?)\"",
"end if",
"end tell",
"end if",
"end tell",
"tell application lastActiveApp to activate",
"get out")
layout.isMuted.text = out

if out == "Unmuted" then
layout.isMuted.color = "orange"
else
layout.isMuted.color = "normal"
end
end

--@help Accept audio call
actions.acceptAudioCall = function ()
script.apple(
"set lastActiveApp to (path to frontmost application as text)", -- save to switch back later
"tell application \"Microsoft Teams\" to activate",
"tell application \"System Events\" to tell process \"Microsoft Teams\"",
"beep",
"keystroke \"s\" using {command down, shift down}",
"end tell",
"tell application lastActiveApp to activate")
end

--@help Decline call
actions.declineCall = function ()
script.apple(
"set lastActiveApp to (path to frontmost application as text)", -- save to switch back later
"tell application \"Microsoft Teams\" to activate",
"tell application \"System Events\" to tell process \"Microsoft Teams\"",
"beep",
"keystroke \"d\" using {command down, shift down}",
"end tell",
"tell application lastActiveApp to activate")
end

--@help Accept audio call
actions.leaveCall = function ()
script.apple(
"set lastActiveApp to (path to frontmost application as text)", -- save to switch back later
"tell application \"Microsoft Teams\" to activate",
"tell application \"System Events\" to tell process \"Microsoft Teams\"",
"beep",
"keystroke \"h\" using {command down, shift down}",
"end tell",
"tell application lastActiveApp to activate")
end