Skip to content

Instantly share code, notes, and snippets.

@opentechnologist
Last active November 14, 2022 18:28
Show Gist options
  • Save opentechnologist/9c8e4c029179316049059b23a327a246 to your computer and use it in GitHub Desktop.
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.
/*
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