Skip to content
Open
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
14 changes: 7 additions & 7 deletions Source/MicMute.spoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ end
function obj:toggleMicMute()
local mic = hs.audiodevice.defaultInputDevice()
local zoom = hs.application'Zoom'
local teams = hs.application.find("com.microsoft.teams")
local teams = hs.application'Microsoft Teams'
if mic:muted() then
mic:setInputMuted(false)
if zoom then
local ok = zoom:selectMenuItem'Unmute Audio'
local ok = zoom:selectMenuItem("(?i)unmute audio", true)
if not ok then
hs.timer.doAfter(0.5, function()
zoom:selectMenuItem'Unmute Audio'
zoom:selectMenuItem("(?i)unmute audio", true)
end)
end
end
if teams then
local ok = teams:selectMenuItem'Unmute'
local ok = teams:selectMenuItem("(?i)unmute", true)
if not ok then
hs.timer.doAfter(0.5, function()
hs.eventtap.keyStroke({"cmd","shift"}, "m", 0, teams)
Expand All @@ -56,15 +56,15 @@ function obj:toggleMicMute()
else
mic:setInputMuted(true)
if zoom then
local ok = zoom:selectMenuItem'Mute Audio'
local ok = zoom:selectMenuItem("(?i)mute audio", true)
if not ok then
hs.timer.doAfter(0.5, function()
zoom:selectMenuItem'Mute Audio'
zoom:selectMenuItem("(?i)mute audio", true)
end)
end
end
if teams then
local ok = teams:selectMenuItem'Mute'
local ok = teams:selectMenuItem("(?i)mute", true)
if not ok then
hs.timer.doAfter(0.5, function()
hs.eventtap.keyStroke({"cmd","shift"}, "m", 0, teams)
Expand Down