Skip to content

Commit 17835fd

Browse files
committed
fix(MicMute): Fix toggling mute button on Teams and Zoom
Corrects the menu item names used to mute/unmute audio in Zoom as they are case-sensitive by making a regex that is case insensitive. This resolves issues where the script fails to correctly toggle the mute state due to changes in application menu. Also changes the way the Microsoft teams app is found due to Teams change in bundle id.
1 parent e5b8712 commit 17835fd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Source/MicMute.spoon/init.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ end
3434
function obj:toggleMicMute()
3535
local mic = hs.audiodevice.defaultInputDevice()
3636
local zoom = hs.application'Zoom'
37-
local teams = hs.application.find("com.microsoft.teams")
37+
local teams = hs.application'Microsoft Teams'
3838
if mic:muted() then
3939
mic:setInputMuted(false)
4040
if zoom then
41-
local ok = zoom:selectMenuItem'Unmute Audio'
41+
local ok = zoom:selectMenuItem("(?i)unmute audio", true)
4242
if not ok then
4343
hs.timer.doAfter(0.5, function()
44-
zoom:selectMenuItem'Unmute Audio'
44+
zoom:selectMenuItem("(?i)unmute audio", true)
4545
end)
4646
end
4747
end
4848
if teams then
49-
local ok = teams:selectMenuItem'Unmute'
49+
local ok = teams:selectMenuItem("(?i)unmute", true)
5050
if not ok then
5151
hs.timer.doAfter(0.5, function()
5252
hs.eventtap.keyStroke({"cmd","shift"}, "m", 0, teams)
@@ -56,15 +56,15 @@ function obj:toggleMicMute()
5656
else
5757
mic:setInputMuted(true)
5858
if zoom then
59-
local ok = zoom:selectMenuItem'Mute Audio'
59+
local ok = zoom:selectMenuItem("(?i)mute audio", true)
6060
if not ok then
6161
hs.timer.doAfter(0.5, function()
62-
zoom:selectMenuItem'Mute Audio'
62+
zoom:selectMenuItem("(?i)mute audio", true)
6363
end)
6464
end
6565
end
6666
if teams then
67-
local ok = teams:selectMenuItem'Mute'
67+
local ok = teams:selectMenuItem("(?i)mute", true)
6868
if not ok then
6969
hs.timer.doAfter(0.5, function()
7070
hs.eventtap.keyStroke({"cmd","shift"}, "m", 0, teams)

0 commit comments

Comments
 (0)