Created
January 14, 2026 13:04
-
-
Save fopina/af078ef1c03b48c2bcc294da9e282f6a to your computer and use it in GitHub Desktop.
Hammerspoon Lua script to run command when zoom meeting starts or stops
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
| -- ========================= | |
| -- Configuration | |
| -- ========================= | |
| local BIN = "~/.local/bin/zengge-led-ctl" | |
| -- LED strip BLE identifier that can be found with `zengge-led-ctl scan` | |
| local DEVICE = "x" | |
| local COLOR_MEETING = "red" | |
| local COLOR_IDLE = "green" | |
| local function runCmd(cmd, param) | |
| return hs.execute(BIN .. " " .. cmd .. " " .. DEVICE .. " " .. param, true) | |
| end | |
| local function setPower(power) | |
| return runCmd("power", power) | |
| end | |
| local function setColor(color) | |
| return runCmd("color", color) | |
| end | |
| -- Create a window filter that only watches zoom.us windows | |
| local wf = hs.window.filter.new(false) -- start with no windows | |
| :setAppFilter("zoom.us", {allowTitles="Zoom Meeting"}) -- only Zoom with title | |
| -- Function to call on creation | |
| local function onCreated(win, appName, event) | |
| print("Zoom Meeting window created!") | |
| print(setColor(COLOR_MEETING)) | |
| end | |
| -- Function to call on destruction | |
| local function onDestroyed(win, appName, event) | |
| print("Zoom Meeting window destroyed!") | |
| print(setPower("0")) | |
| end | |
| -- Subscribe to the events | |
| wf:subscribe( | |
| hs.window.filter.windowCreated, onCreated | |
| ):subscribe( | |
| hs.window.filter.windowDestroyed, onDestroyed | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment