I discovered Hammerspoon today, a keybinding and desktop automation tool reminiscent of i3wm or awesonewm for linux, but combined with something like xdotool
.
I am an emacs user, and find emacs's (and similarly vim's) solution of using "prefix" keys to support more keybindings useful.
In emacs (and vim) you can support "prefix" keys, which once pressed select a different map of keybindings. So for example:
C-x followed by , followed by v
could be bound to a single keybinding which is different from v
.
Is there any way to acheive this in hammerspoon (short of writing my own library that toggles bindings on and off as I press keys)?
Research
- This script seems to implement a special case of this sort of logic in a handcode way
- This native component, hs.hotkey.modal, looks to provide "modes" similar to i3.
- https://github.com/Hammerspoon/hammerspoon/issues/208
- https://www.hammerspoon.org/Spoons/RecursiveBinder.html