Keyboard Chords with Hammerspoon

I love keyboard shortcuts. The less I have to switch between keyboard and mouse, the more efficient I (at least feel I) can be!

Problem statement

But there are only so many unique combinations of keys on a standard keyboard. Assume 26 letters, 10 digits, and (for now) 20 other characters, along with 4 ‘modifier’ keys (⌘ ⌃ ⌥ ⇧) that you can use in any combination of one or more. So 26 * 10 * 20 * (2^4 - 1) = 78,000 . Like I said. Limited. 😄

But we can do better!

Enter the Hammerspoon hs.hotkey.modal module!


Once Again, to Hammerspoon

Why oh why doesn’t macOS have a more powerful window manager…

Once upon a time, I moved from primarily Windows to primarily (at the time) OSX. I missed Aerospace–the ability to use Win+Left/Right to snap windows to half the screen–so I wrote a fix: Duplicating AeroSnap on OSX with Hammerspoon.

Since then, I eventually discovered and moved to Magnet and all was well.

But more recently, I’ve been wanting two things:

  • a bit more control (once again), to define more arbitrary sizes and keystrokes
  • the ability to automatically arrange windows to various Mission Control Spaces

And what a journey it’s been…


Duplicating AeroSnap on OSX with Hammerspoon

Relatively recently, I switched my last Windows machine over to OSX. For the most part, it’s been great. One bit of functionality that I’ve been missing though is AeroSnap. Specifically the ability to use a keyboard shortcut to move windows to the left/right half of a monitor.