Skip to content

Instantly share code, notes, and snippets.

@eparadis
Last active January 25, 2022 02: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 eparadis/3c507e1b5d2e00ebacceef4879207655 to your computer and use it in GitHub Desktop.
Save eparadis/3c507e1b5d2e00ebacceef4879207655 to your computer and use it in GitHub Desktop.
quick hack to set the LED on my prototype desktop mute button
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