I use one split keyboard with two computers: a MacBook over USB and a second machine over Bluetooth. I kept typing into the wrong one because I forgot to press the output toggle, so I built something that presses it for me.
What it does
A small Mac menu bar app watches where you are looking through the MacBook camera. Look at the MacBook and the keyboard outputs over USB. Look toward the other computer and it switches to a BLE profile. There is no key to press.
How it works
- A ZMK module adds a tiny serial protocol over USB CDC, so the host can ask the keyboard to switch output (`U` for USB, `B<n>` for a BLE profile).
- The Mac app (GazeSwitch) uses Apple's Vision framework for head direction and eye position, and switches when your gaze rests on one side for 0.4 seconds. That delay stops a quick glance from flipping the output.
- You calibrate once by looking at each screen in turn.
Privacy
Video is processed on the Mac, frame by frame, and is never stored or sent anywhere. The app makes no network connections. All the code is in the repo.
What you need
- A ZMK keyboard that connects to the Mac over USB and to the other computer over BLE
- A MacBook (macOS 13 or later, Apple silicon or Intel)
- A firmware build with the module added to your `west.yml` and the `host-output-switch` snippet enabled
Limitations, honestly
- The host app is Mac-only. The firmware side is plain serial, so a Linux or Windows client is possible, but I have not written one.
- I have only tested it on my own keyboard, a split running a ZMK fork based on v0.3. It should work elsewhere, but I can't promise it.
- With a face mask on, it falls back to head direction only, which is less precise.
- It uses about 20% of one core on an M1 Max while running.
https://github.com/aimdevlee/zmk-gaze-switch
Happy to answer questions, and I'd like to hear if it works on your board.