Hotkeys to launch different modals
Is it possible to add to the below (basically, have multiple hotkeys which launch different modals)?
(local common-keys
{:mods [:cmd :shift :alt :ctrl]
:key :space
:title "Apps"
:items app-bindings})
(local config
{:title "Main Menu"
:items menu-items
:keys common-keys})
Not currently supported, or even anticipated but could be feasible. I'm going to prioritize #72 for now and then can look into this possibly after. If you wish to make a PR feel free to give it a shot 🙂
This shouldn't be difficult, and it makes sense to me.
A plan of attack:
- Have
modal.activate-modaltake a fsm as an arg. Probably default to the one locally defined in the module. (let [fsm (or _fsm fsm)]) - Take most of the functionality out of
modal.init. Put it into somecreate-modaland make it return the fsm (+ cleanup func?) modal.initnow basically does(set fsm (create-modal config))- Whoever wants to define a separate modal menu system just creates one in their config and calls these functions manually e.g.
(local mymodal (lib.modal.create-modal myfsm))and binds a key to(fn [] (lib.modal.activate-modal mymodal))
I don't think users should have to define custom state machines, more like the modal state machine should accept custom menu objects. I think there's an event on the modal state machine already like this that takes a submenu of the current modal to display that like when entering from Main -> Window.
With the advice system done, I should be able to make the required updates if needed to support this by the end of this weekend.
@ihodes Out of curiosity, what makes that feature more desirable than pressing cmd+space a to access the apps menu? Especially if you press cmd+space it will show "Apps ..... a`, where as this proposal means the binding is hidden.