houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
298 stars 25 forks source link

[Discussion] Shift modifier position #49

Closed RichardFevrier closed 1 year ago

RichardFevrier commented 1 year ago

Thank you for your work 🎉

And let's take this configuration for example:

Meta{ArrowDown} >> Control{End}

So, if we press Meta{ArrowDown}, Control{End} is resolved everything is great so far! 👍️

Now, let's play with the Shift modifier.

1) If we press Shift{Meta{ArrowDown}}, Shift{Control{End}} is resolved, still great! 👍️ 2) But what if we press Meta{Shift{ArrowDown}}, Meta{Shift{Control{End}}} is resolved... and that is not what expected. ⚠️

What is expected is Meta{Shift{ArrowDown}} or if we consider Shift as a modifier (should be that anyway) it should be Shift{Control{End}} like 1)

I made a fix on my branch if you agree with my last conclusion, tell me and I will make a pull request then you will be able to review it.

houmain commented 1 year ago

Hi, thanks! I tried your configuration and input and came to the conclusion, that this is how it is currently supposed to work. When Meta{Shift} is pressed, both are forwarded. When ArrowDown follows, while Meta is still hold, Meta is still considered as an optional prefix (last rule of https://github.com/houmain/keymapper#functional-principle), so it finds the mapping and outputs Control{End}. Does it cause problems? Can you add an additional mapping to the get the desired behavior?

RichardFevrier commented 1 year ago

I don't understand,

If we keep the Meta{ArrowDown} >> Control{End} configuration.

Why would Control{End} be resolved when we press Meta{Shift{ArrowDown}} since Shift is between Meta and ArrowDown ?

If someone like me wants only Control{End} be resolved when absolute Meta{ArrowDown} is pressed and not Meta{Whatever{ArrowDown}} what should be the configuration then?

houmain commented 1 year ago

Why would Control{End} be resolved when we press Meta{Shift{ArrowDown}} since Shift is between Meta and ArrowDown ?

When Meta{Shift} is pressed, both are forwarded and as long as they are hold, still considered as optional prefix to the input sequence. Each is optional on its own.

Pressing Meta{A{B}} with this configuration:

Meta{A} >> R
Meta{B} >> S

would output R and S instead of R and B. So the A between Meta and B is also ignored, since it already matched once.

Do you want both Meta{Shift{ArrowDown}} and Shift{Meta{ArrowDown}} to map to Shift{Control{End}}?