Skip to content

Instantly share code, notes, and snippets.

@redblacktree
Created October 30, 2020 18:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redblacktree/c1fa66f80daadf22287b425778beaf78 to your computer and use it in GitHub Desktop.
Save redblacktree/c1fa66f80daadf22287b425778beaf78 to your computer and use it in GitHub Desktop.
Push to Talk for Microsoft Teams using Hammerspoon on Mac/OS X
KEYSTROKE_DURATION = 1 -- A one-microsecond delay worked for me YMMV
PUSH_TO_TALK_KEY = "f13"
-- Microsoft Teams Push-to-Talk
function toggleMute()
currentApp = hs.application.frontmostApplication()
teamsApps = hs.application.applicationsForBundleID('com.microsoft.teams')
teamsApp = teamsApps[1]
teamsApp:activate()
hs.eventtap.keyStroke({"shift", "cmd"}, "m", KEYSTROKE_DURATION)
currentApp:activate()
end
hs.hotkey.bind({}, PUSH_TO_TALK_KEY, toggleMute, toggleMute)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment