A couple years ago, we invested in Luxafor flag lights for everyone on the team. These lights are attached to our monitors and we communicate with each other using them. If someone's light is green, they are "free" and you're welcome to drop by and interrupt what they're doing. If someone's light is red, they are in do-not-disturb mode for one reason or another. They might be on a zoom call or they might just not want to be interrupted.

The Luxafor lights come with an app that can control your flag light all sorts of ways. There are animated patterns. There's a pomodoro mode. It can integrate with other services to automatically set your color. And it can (sort of) let you program OS-wide keyboard shortcuts to set the flag color. When we first got our lights, this worked flawlessly. But Luxafor's app has degraded in stability over time and the keyboard shortcuts have taken a big hit. For many months, I've been unable to set up a shortcut for setting the flag to green. And my flag defaults to red whenever I disconnect and reconnect it. Since all we use the flags for is toggling between red and green, this regression has been painful.

I've pleaded with Luxafor to fix the critical bug of keyboard shortcuts being broken. I've heard nothing back. It's time to cut out the middle man. Here's what I wanted:

  1. An OS-wide shortcut that sets the light to green (^⌥⌘G)
  2. An OS-wide shortcut that sets the light to red (^⌥⌘R)
  3. For these shortcuts to reliably work every time I use them
  4. No need to launch an app or click anything in the UI

I didn't feel like this was asking too much, but it took a little time to get it figured out. Thankfully, Matt Goucher had already published a node-luxafor package to NPM that did all of the heavy lifting. With that in place, all I needed to do was:

  1. Write a CLI over top of node-luxafor
  2. Find a way to run the CLI from an OSX keyboard shortcut

The Node Luxafor CLI

I created node-luxafor-cli as a thin CLI wrapper around node-luxafor. Right now, it's just js files that can be invoked with node.

  • node green - sets the flag color to green
  • node red - sets the flag color to red
  • node index --color=blue - sets the flag color to blue
  • node index -r 255 -g 255 -b 255 - sets the flag color to white

This package has plenty of room for maturation, but it gives me all I needed to start.

Keyboard Shortcuts

The keyboard shortcuts were where I had the most to learn. Here's what was involved:

  1. Create Automator Services that run Shell Scripts to invoke node and run the node-luxafor-cli scripts
  2. Configure Keyboard Shortcuts to run the Automator Services

Automator Services

An Automator Service can register an application in application menus. With the right configuration, the service can be registered to be available in the menu of any application.

Here are the steps to create the Automator Services for Luxafor-Red and Luxafor-Green.

  1. git clone git@github.com:jeffhandley/node-luxafor-cli.git
  2. Open Automator.app
  3. Choose "Service" as the type of document
  4. Select that the "Service receives: in "
  5. Select "Run Shell Script" from the actions library and drag it into the surface
  6. Ensure an appropriate Shell is selected
  7. In the script box, put in the equivalent of "node node-luxafor-cli/green", but you will need to provide your full path for node as well as the full path for where you cloned node-luxafor-cli - for me, it was /Users/jeffhandley/.nvm/version/node/v8.9.3/bin/node /Users/jeffhandley/code/node-luxafor-cli/green
  8. Press the Run button to test the service - your light should turn green
  9. Save the service as Luxafor-Color-Green

With this Automator Service created, follow the same steps to create one for setting the light to red.

Keyboard Shortcuts

This was finicky to figure out, but it turns out the biggest catch was how the Automator script was created. It must be a Service and it must be configured to use all applications. With that in place, the following should work for you.

  1. Open your System Preferences
  2. Go to your Keyboard preferences
  3. Select Shortcuts
  4. Choose Services on the left
  5. Scroll to the very end and the Luxafor-Color-Green and Luxafor-Color-Red services should be listed
  6. Click on the row at the right and get into the Add Shortcut mode
  7. Press the key combination you want to assign to each
  8. Close your Keyboard preferences window


With this in place, your keyboard shortcuts should work. If they don't, here are some settings to check that seem to be touchy.

  • The "Shell" selection in the Automator Service. Mine defaulted to /usr/bin/zsh, but that didn't save properly. When I opened the service back up in Automator (easily done from the Keyboard shortcuts list), the Shell field was blank. I set it to /bin/zsh and this has worked.
  • The Automator script was saved as a generic Workflow and it didn't show up in the General list of services. I had to use the Convert to... UI and choose to convert it to a Service.
  • The paths for node or the script were incorrect. Just be careful with these and test them inside the Automator UI.