Last active
November 14, 2022 18:28
-
-
Save opentechnologist/9c8e4c029179316049059b23a327a246 to your computer and use it in GitHub Desktop.
a snippet that provides push-to-talk capability during meetings on google meet.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
GOOGLE MEET PUSH TO TALK (USING CONTROL KEY) | |
as soon as a meeting is joined, press F12 to open web developer tools. | |
select the console tab and copy-and-paste this code and press enter. | |
close the web developer tools, and use google meet normally. | |
press-and-hold control key down when talking, release when finished. | |
*/ | |
javascript: (() => { | |
const selector = '[aria-label*="microphone"][data-is-muted="%"]'; | |
const pushToTalk = () => ({ key, shiftKey, ctrlKey, altKey }) => { | |
if (key === 'Control' && !shiftKey && !altKey) { | |
const mutedSelector = selector.replace('%', ctrlKey); | |
document.querySelectorAll(mutedSelector).forEach(element => { | |
element.click(); | |
}); | |
} | |
}; | |
document.body.onkeyup = pushToTalk(); | |
document.body.onkeydown = pushToTalk(); | |
document.body.dispatchEvent( | |
new KeyboardEvent('keyup', {key: 'Control'}) | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment