Last active
January 26, 2022 07:07
-
-
Save rooreynolds/10f16deb16ef05a4ade1b9cd7351ba02 to your computer and use it in GitHub Desktop.
Arduino / Teensyduino code for a keyboard interface to toggle mute and camera controls in 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
/* | |
* A simple arduino app to send a keyboard combination (Command + F1) | |
* when a button is pushed. This key combination can, using an app like | |
* FastScripts (https://red-sweater.com/fastscripts/) or similar, | |
* trigger a script to perform a specific action, for example | |
* to mute the teleconferencing app of your choice. | |
* | |
* Useful scripts for running at the desktop side: | |
* - Google Meet: https://github.com/aezell/mutemeet | |
* - Zoom: https://gist.github.com/mgaruccio/15734cb2f1442c457f0fa25dd838cc6d | |
* - Teams: https://gist.githubusercontent.com/rooreynolds/10f16deb16ef05a4ade1b9cd7351ba02/raw/3cbd645a9b7cba12142393aad835eba72d282f4e/MuteTeams.scpt | |
*/ | |
#include <Bounce.h> | |
int pin_black = 4; | |
Bounce blackButton = Bounce(pin_black, 100); // 100 ms debounce | |
int cmdKey = KEY_LEFT_GUI; // for OSX. For Win/Linux, try KEY_LEFT_CTRL | |
int shiftKey = KEY_LEFT_SHIFT; | |
int f1Key = KEY_F1; // | |
void setup() { | |
Serial.begin(9600); | |
pinMode(pin_black, INPUT_PULLUP); | |
Serial.println("setup complete"); | |
} | |
void pressCmdF1() { | |
Keyboard.press(cmdKey); | |
Keyboard.press(f1Key); | |
delay(100); | |
Keyboard.releaseAll(); | |
} | |
void cmdPress(int key) { | |
Keyboard.press(cmdKey); | |
Keyboard.press(key); | |
delay(100); | |
Keyboard.releaseAll(); | |
} | |
void shiftCmdPress(int key) { | |
Keyboard.press(cmdKey); | |
Keyboard.press(shiftKey); | |
Keyboard.press(key); | |
delay(100); | |
Keyboard.releaseAll(); | |
} | |
void loop() { | |
if (blackButton.update()) { | |
if (blackButton.fallingEdge()) { | |
pressCmdF1(); | |
} | |
} | |
} |
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
-- from https://github.com/aezell/mutemeet/blob/master/MuteMeet.scpt | |
tell application "Google Chrome" | |
activate | |
set i to 0 | |
repeat with w in (windows) -- loop over each window | |
set j to 1 -- tabs are not zeroeth | |
repeat with t in (tabs of w) -- loop over each tab | |
if title of t starts with "Meet " then | |
set (active tab index of w) to j -- set Meet tab to active | |
set index of w to 1 -- set window with Meet tab to active | |
delay 0.5 | |
do shell script "open -a Google\\ Chrome" -- these two lines are hackery to actually activate the window | |
tell application "System Events" to tell process "Google Chrome" to keystroke "d" using command down -- issue keyboard command | |
return | |
end if | |
set j to j + 1 | |
end repeat | |
set i to i + 1 | |
end repeat | |
end tell |
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
tell application "Microsoft Teams" | |
activate | |
tell application "System Events" to tell process "Microsoft Teams" | |
keystroke "m" using {shift down, command down} -- shortcut keys: https://support.microsoft.com/en-us/office/keyboard-shortcuts-for-microsoft-teams-2e8e2a70-e8d8-4a19-949b-4c36dd5292d2 | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment