IcarusWorks / ember-key-manager

A service for (un)binding keyboard up and down events.
MIT License
42 stars 11 forks source link

Two macros for the same shortcut? #32

Closed gossi closed 6 years ago

gossi commented 6 years ago

I do register macros from different areas of my app, though on the same page. It happens that I do register two macros with the same execution key (since they are user defined). Both macros are valid, means I would expect both to trigger yet only the first one is invoked.

Question here is: I don't see anything wrong with having two macros with the same shortcut and triggering two different actions. However, I'm wondering if I am doing something wrong here or I'm expecting something different?

jordpo commented 6 years ago

We only fire one callback per key event. In the case of a collusion (two macros with the same execution and modifier keys), we expose a priority flag for the app to choose which macro's callback should be fired. We definitely never considered the desire to have multiple callbacks fired at the same time. @patrickberkeley what are your thoughts here?

jordpo commented 6 years ago

@gossi I talked to Patrick and I think we are going to implement a change where macros with the same execution and modifier keys and priority will all have their callbacks invoked on a match. I should probably have a PR in the next day or so.