Last active
January 25, 2022 02:05
-
-
Save eparadis/3c507e1b5d2e00ebacceef4879207655 to your computer and use it in GitHub Desktop.
quick hack to set the LED on my prototype desktop mute button
This file contains hidden or 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
import subprocess | |
def send(cmd): | |
subprocess.run(['bash', '-c', "echo %s > /dev/cu.usbmodem142303" % cmd ]) | |
process = subprocess.run(['osascript', 'getZoomStatus.applescript'], stdout=subprocess.PIPE) | |
status = process.stdout.decode().split(',') | |
print(status) | |
state = {y[0]: y[1] for y in [x.split(':') for x in status]} | |
if state['zoomStatus'] == 'call': # you're in a call | |
cmd = 'L' | |
if state['zoomMute'] == 'unmuted': | |
cmd += '1' # send('L10') | |
elif state['zoomMute'] == 'muted': | |
cmd += '2' # send('L20') | |
else: | |
cmd += '0' #send('L00') | |
if state['zoomVideo'] == 'started': | |
cmd += '1' | |
elif state['zoomVideo'] == 'stopped': | |
cmd += '2' | |
else: | |
cmd += '0' | |
send(cmd) | |
elif state['zoomStatus'] == 'closed': # zoom isn't even open | |
send('L00') | |
elif state['zoomStatus'] == 'open': # zoom is open, but you're not in a call | |
send('L00') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment