A better Hyper key hack for Sierra

[Tweet : ADN : nvALT]

In the last Web Excursions, I posted a hack for getting Hyper Key functionality back in Sierra. It uses Karabiner-Elements and Keyboard Maestro. It couldn’t do one of the things I liked best about the Hyper key, though: allow me to tap it without hitting any other keys to use send Escape. My muscle memory for that has gotten to the point where using Vim without it is an exercise in pain.

Matt Petty posted a different hack to GitHub, one using Hammerspoon with Karabiner-Elements for more flexibility. Granted, it’s a lot more complex to configure, but I now have full functionality back.

Here’s a link to the necessary configuration files. I also put my own Hammerspoon configuration up with a few ideas for using it the way I was used to. My Hyper key shortcuts were frequently app shortcuts, so that’s what’s listed in the example.

I had most of my other shortcuts set up through BetterTouchTool and System Preferences, so I’m just adding lines to the Hammerspoon config to send the same key combination and continue to trigger those.

I made some for loops in my examples to allow more efficient configuration of a bunch of keys. Even if you don’t know Lua (I sure don’t) it should be pretty easy to extend those lists. By the way, the Lua section at tutorialspoint was quite helpful with learning the syntax basics.

Matt also helped me figure out the combination of Lua and Hammerspoon API calls needed to create sequential hotkeys. In my example, you’ll see a section where I configure it such that hitting Hyper-A,F opens Finder. A lot of my app shortcuts were based on this kind of thing because it allows me to group apps by type under a single letter, then use common keys to launch apps within that type. More combinations available, which is kind of the point of the Hyper key to begin with.

Hammerspoon can do a lot more with automation and shortcuts. It’s definitely worth checking out.