Skip to content

Instantly share code, notes, and snippets.

@lyallcooper
Last active December 8, 2023 22:14
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyallcooper/10f48ab050ac8594fe46335e49c99c46 to your computer and use it in GitHub Desktop.
Save lyallcooper/10f48ab050ac8594fe46335e49c99c46 to your computer and use it in GitHub Desktop.
AppleScript for toggling mute in Google Meet
tell application "Google Chrome"
repeat with w in (windows)
set i to 1 -- tabs are one indexed
repeat with t in (tabs of w)
if URL of t starts with "https://meet.google.com" then
tell tab i of w
-- These selectors may be unstable, but seem to work well now
execute javascript "document.querySelectorAll('[data-is-muted]')[1].click()"
set muted to (execute javascript "document.querySelectorAll('[aria-label=\"Turn on microphone (⌘ + d)\"]').length === 1")
if muted then
display notification "Meet muted" with title "🔇"
else
display notification "Meet unmuted" with title "🔈"
end if
end tell
return
end if
set i to i + 1
end repeat
end repeat
end tell
display notification "No active Meet found" with title "⚠️" subtitle "Could not toggle mute"
@icampana
Copy link

This also works for the muted state and doesn't depend on a perfect match with the command character:

set muted to (execute javascript "document.querySelectorAll('[aria-label^=\"Turn on microphone\"]').length === 1")

@krashnakant
Copy link

can we have script for activating the DND mode when MS team video/audio or gMeet call started

@lyallcooper
Copy link
Author

@krashnakant
Copy link

@lyallcooper Thanks a lot, There is no update since 21 June 2021 to this project, do you have another alternative for me please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment