Disclaimer: despite what people seem to assume when you buy a mechanical keyboard, I am not a keyboard fetishist. I’ve been using Microsoft Sculpts for over a decade because of historical repetition injury issues, and with Microsoft discontinuing the Sculpt and the new manufacturer taking their time taking over, all I want is a keyboard which is like a Sculpt, except where I haven’t worn out the space bar. I will then go back to thinking approximately never about keyboards.
So, the keyboard I could find which was closest to the Sculpt after a lot of Googling was a Keychron K15 Max, which is a QMK keyboard. For those which don’t know, which included me until yesterday, QMK is the open source firmware that many of these mechanical keyboards run and yes you really can customize the firmware on your keyboard now. The K15 is a 75% “Alice” layout, which means split with no numpad. It does have media, function, and macro keys which is nice. I’ve never had a keyboard with macro keys before. It also has low profile switches, which is nice because the Sculpt basically has laptop style switches, and I chose the Gateron Brown low profile switches because I didn’t think I wanted the tactile “clicky” thing. Then again, I have now tried exactly one mechanical keyboard, so its entirely possible the K15 isn’t “perfect” for me — its simply good enough to make me stop thinking about such things.
So this leads to the Michael Problem Of The Day — I listen to music in my office using a Sonos system. While there is a Sonos app for the mac, it doesn’t appear that MacOS recognizes it as a music playback app like it does Spotify, and it gets super confused about the volume controls not controlling the volume on the mac itself, but this other device on my network.
Now — I could solve these two problems if I could cause the media keys on the K15 to run command line programs, as I already have a command line app which does things like skip tracks, volume control, etc. But like I said, the K15 only emits keypresses and the MacOS built in keyboard shortcut thing doesn’t appear to support running commands.
In the end, I spend an hour or so and built a Rube Goldberg machine to solve my problems:
- Keychron K15 75% Alice keyboard with media keys remapped to otherwise unused macro keys.
- For those macro keys, each is assigned a particularly unlikely unique keypress combination — for example ctrl-splat-alt-Q is pause / play. One of the key learnings for me having never used a QMK keyboard before is that you can only send keypress events to the machine — I was expecting mac side software and to be able to more directly trigger things, but that doesn’t seem to be a thing.
- KeyboardMaestro on the mac with those macro keypress combinations mapped to hotkeys that run shell scripts.
The shell scripts use https://pypi.org/project/soco-cli/ to send commands to the sonos over the network. This is surprisingly reliable once I built it all out and makes me happy.
Now, one sad bit is I have two desks in my office — a work one and a personal one. There is strict separation — the work machine is not on my home network, it is on its own VLAN which only sees the ISP NTD. This is partially because of recent high profile compromises where an employee’s personal use of a computer was used to breach their employer (LastPass and Medibank I’m looking at you), but also because there have been allegations that my employer’s cyber team will scan the networks their endpoints are on and I have zero enthusiasm for a corporate cyber team pentesting my home network. All that said, this means that such an arrangement wouldn’t work for a keyboard on my work desk.
Well, except… KeyBoardMaestro can call webhooks. So I could so something with home assistant providing a webhook to call soco-cli, but haven’t really thought about it in detail yet.