request: better overlapping combos
wmertens opened this issue · comments
when you have e.g.
[main]
a+s = layer(leftcontrol)
[leftcontrol:C]
d = swap(controlshift)
[controlshift:C-S]
then when you hold ASD all at once, it won't switch into controlshift
. You have to add:
[main]
a+s+d = layer(controlshift)
However, then when you let go of D, it doesn't go back to leftcontrol.
Ideally, you'd configure this like
[main]
a+s = layer(leftcontrol)
a+s+d = layer(controlshift)
[leftcontrol:C]
[controlshift:C-S]
and it would automatically handle all the in-between situations when chording, and go in and out of shift when adding and releasing D.
I can see the use of this, but I don't think it's easy to arrive at a general mechanism, because: if you hold a+s
to get a control
, and then strike d
, how would you distinguish between whether you meant C-d
vs going to a different layer? Perhaps you could explicitly bind d
to noop
in leftcontrol
to disambiguate for keyd, but it would feel a bit magic.
Reverting to another chord when letting go of one of the keys is a bit more straightforward, but even then, there is some magic involved: what if your a+s+d
emits, say, esc
, and a+s
emits enter
? Should enter
be emitted as soon as you let go of d
? We can probably limit this behaviour to chords bound to layers, but my point is: if we really are to go down this road, it's going to take some thinking to keep things simple.
It would also violate the expectation that one can let go of n-1 constituent keys without leaving the chord (cf #703, #320 (comment)).
In any case, for the particular use case you described, the following would already add/remove the shift modifier at will:
[main]
a+s = layer(leftcontrol)
[leftcontrol:C]
d = layer(shift)
Would that be acceptable?
Right I understand the concern, but I simply wouldn't have ambiguity in my mappings.
If I have overlapping chords, I have no expectations of using the constituents together with other combos, and even if I did I would explicitly set it in the layer.
Letting go of constituents is also fine as long as you don't map to a shorter combo, same reasoning.
The workaround is not good because if you type a+d and then s, it will not see it as a+s with d. Furthermore that only works with layers you can combine, when you have to swap you can't leave the layer again.
So in conclusion I think the ambiguity is clear when you set up your combos like that, no?
I'm willing to work on this with help, I've already taken a look at the code but I'm not entirely sure how it all works together. Are there any resources that go over the algorithms?