1
2
3
4
5
6
7
8
9
10
11
12
13
14
(local mash [:cmd :alt :ctrl])
(local smash [:shift :cmd :alt :ctrl])

(fn modal-bind [mods key message bindings]
  (let [modal (hs.hotkey.modal.new mods key message)]
    (tset modal :entered #(hs.timer.doAfter 1 #(modal:exit)))
    ;; (tset modal :exited #(hs.alert :bye))
    (each [_ [mods key message f] (ipairs bindings)]
      (modal:bind mods key message
                  #(do
                     (f)
                     (modal:exit))))))

{: mash : smash : modal-bind}