Create emacs-style keychains keybindings in hammerspoon?
If you're still wondering how to do this, then the RecursiveBinder Spoon for Hammerspoon will do the trick. I wrote a Medium article about how to use it to make a leader key for macOS.
Here is a minimal lua snippet on how to use it.
hs.loadSpoon(&quot;RecursiveBinder&quot;)  -- Load the spoon 

spoon.RecursiveBinder.escapeKey = {{}, 'escape'}  -- Press escape to abort

-- singleKey is a convenience function provided in the Spoon
local singleKey = spoon.RecursiveBinder.singleKey

local keyMap = {
  [singleKey('b', 'browser')] = function() hs.application.launchOrFocus(&quot;Firefox&quot;) end,  -- 'b' is the keybinding, 'browser' is the text shown in the onscreen helper text
  [singleKey('t', 'terminal')] = function() hs.application.launchOrFocus(&quot;Terminal&quot;) end,
  [singleKey('d', 'domain+')] = {  -- Separate layer
    [singleKey('g', 'github')] = function() hs.urlevent.openURL(&quot;github.com&quot;) end,
    [singleKey('y', 'youtube')] = function() hs.urlevent.openURL(&quot;youtube.com&quot;) end
  }
}

-- Calling recursiveBind returns the activation function, and here, it is bound to option+space
hs.hotkey.bind({'option'}, 'space', spoon.RecursiveBinder.recursiveBind(keyMap))  

Here, pressing option+space activates the first layer with b, t, d (browser, terminal, domain respectively)
Pressing d will activate the layer with g and y.
At each level, a helper text is shown, like which-key in emacs.