Skip to content

Instantly share code, notes, and snippets.

@40thieves
Last active April 10, 2024 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 40thieves/219349def9fb4f2967c80c56412ff486 to your computer and use it in GitHub Desktop.
Save 40thieves/219349def9fb4f2967c80c56412ff486 to your computer and use it in GitHub Desktop.
Script to globally mute Google Meet in a Chrome window (using Raycast script commands)

Meet Mute

Script to globally mute Google Meet in a Chrome window (using Raycast script commands)

Installation

  1. Ensure that chrome-cli is installed
  2. (Technically optional) Create a new Raycast script command and copy/paste the source of the files below
  3. (Optional) Configure a Raycast global hotkey for faster triggering

Usage

Script Description
meet-mute.sh Mutes unconditionally
meet-toogle-mute Toggles mute on/off
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Meet Mute
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🔇
TABS=`OUTPUT_FORMAT=json chrome-cli list tabs`
MEET_TAB_ID=`echo $TABS | jq --raw-output '.tabs[] | select(.url | test("meet[.]google[.]com.+[a-z]{3}-[a-z]{4}-[a-z]{3}"; "i")) .id'`
chrome-cli execute "(function () {try {var btn = document.querySelector('button[data-is-muted]');var isMuted = btn.dataset.isMuted === 'true';if(!isMuted){btn.click();return 'Meet muted';}else{return 'Already muted'}} catch (err) {return 'Error: ' + err;}})();" -t $MEET_TAB_ID
# Unminified JS:
# (function () {
# try {
# var btn = document.querySelector('button[data-is-muted]');
# var isMuted = btn.dataset.isMuted === 'true';
# if (!isMuted) {
# btn.click();
# return 'Meet muted';
# } else {
# return 'Already muted'
# }
# } catch (err) {
# return 'Error: ' + err;
# }
# })();
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Meet Toggle Mute
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🔈
# export CHROME_BUNDLE_IDENTIFIER="company.thebrowser.Browser"
TABS=`OUTPUT_FORMAT=json chrome-cli list tabs`
MEET_TAB_ID=`echo $TABS | jq --raw-output '.tabs[] | select(.url | test("meet[.]google[.]com.+[a-z]{3}-[a-z]{4}-[a-z]{3}"; "i")) .id'`
chrome-cli execute "(function(){try{var btn=document.querySelector('button[data-is-muted]'),isMuted='true'===btn.dataset.isMuted;return btn.click(),isMuted?'Meet unmuted':'Meet muted'}catch(err){return'Error: '+err}})();" -t $MEET_TAB_ID
# Unminified JS:
# (function () {try{var btn = document.querySelector('button[data-is-muted]');
# var isMuted = btn.dataset.isMuted === 'true';
# btn.click();
# return isMuted ? 'Meet unmuted' : 'Meet muted';
# } catch (err) {
# return 'Error: ' + err;
# }
# })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment