Alex Watt

About Hacks Recommendations

Turning on Key Lights for Google Meet

I got two Elgato Key Light Airs for better lighting when I am on video calls. After setting them up, I wondered: How do I turn them on automatically for video calls?

I wanted to open a Google Meet link and have the lights turn on instantly, like my webcam.

I started Googling. I found this blog post by Evan Travers, and built off of that. Evan used Hammerspoon, a desktop automation tool for macOS that uses Lua and ships with a ton of APIs. I used four APIs:

  1. The Bonjour API to find all the Key Lights on my network
  2. The HTTP API to turn the lights on or off
  3. The USB API to check if my MacBook is docked: I didn’t want the lights turning on if I was taking a call away from my desk!
  4. The AppleScript API to check if Google Meet is open in Chrome

My usage of the first three APIs is almost a copy/paste of Evan’s code, with two main exceptions:

The last part, checking if Google Meet was open, took me a bit of time. At first I was using the JXA integration, but I switched when I noticed a memory leak, which is documented here.

I’ve been using my solution for over a month now and it works great! It’s on GitHub in my hammerspoon-config repo.

At the time of writing, it’s organized in two chunks (permalinks below):

Hope this helps someone else. Happy hacking!

Posted on 07 Jan 2023.