Swipeback on custom layout - propose adding special modifier
Thanks for great app!
I'm making custom layouts with lots of letters and words assigned to swipes. I want to apply custom modification for swipe-backs (swiping away from center of a key and then back to the center - the gesture that converts "<" into "«" in demo). In this sample
<keyboard name="test_backswipe" script="test">
<row>
<key c="x" se="y" />
<key c="z" se="ttt" />
</row>
<modmap>
<fn a="y" b="foo" />
<fn a="ttt" b="bar" />
</modmap>
</keyboard>
I expect that swiping from and back the "x" key will give me "foo" and the same for "z" key gives "bar" but instead I got "Y" and "Ttt" (capitalized first letter) as if I pressed Shift and swiped in just one direction. Pressing Fn button works as I want but I'd like swipeback to work too.
As I understand if Shift modifier is applicable to the value of nw...se attribute then it is used, not Fn. I suppose this is the intended behavior to enable quick capitalization. So if I try
<shift a="y" b="y" />
<shift a="ttt" b="ttt" />
or even
<shift a="y" b="foo" />
<shift a="ttt" b="bar" />
then swipebacks give "foo" and "bar" but now I can't get capital "Y".
What I propose is to add a completely new modifier for swipebacks. For example call it swpb:
<swpb a="y" b="foo" />
If it is present for the value of nw...se then it can be applied first and then Shift and Fn may be applied to the result if they are active.
If it is not present then app keeps current behavior.
Thanks for considering this request!
Hi! Thanks for opening this issue.
You are totally right that a different modmap is needed. I added the <gesture/> modmap in https://github.com/Julow/Unexpected-Keyboard/pull/1083, could you have a try ?
The debug APK is here: https://github.com/Julow/Unexpected-Keyboard/actions/runs/17252418831?pr=1083
I called it gesture rather than swpb because it also affects the circle gesture and that's how it was called internally.
Thank you very much for such quick and complete resolution of this issue!
I tried the debug APK and the <gesture> modmap works perfectly!
The only small problem (I didn't think about this before) is that now user can not look up gesture modmaps before using them.
I think this is important because when a new user starts using a layout he/she won't remember all the modmaps or even know they exist at all.
This can be easily worked around by creating identical <gesture> and <fn> modmaps. Maybe this workaround is actually the best solution because round-trip swipes may be hard to do for some users.
Introducing another xml tag would help to avoid duplication of xml code, like <gesture_fn a="y" b="foo" /> or <map gesture="1" fn="1" a="y" b="foo" /> but maybe it will lead to unjustified over-complication of specification and parser code.
Maybe a better solution would be to add a new special button to the keyboard to manually turn on gesture mapping like Fn buttons turns on fn mapping. This button doesn't have to be in standard bottom row - it's only needed in custom layouts. Even so I don't know if it's a good idea - how many mapping buttons do we need?
Anyway, with <gesture> modmap I can do everything I planned for my custom layouts.
Thank you very much again for resolving this issue!
This is a good point. Maybe the <fn/> mappings are the right one for gestures ? Can you try this change ? https://github.com/Julow/Unexpected-Keyboard/pull/1085
This is a good point. Maybe the
<fn/>mappings are the right one for gestures ? Can you try this change ? #1085
this is perfect, thanks! itd also be wonderful if the same logic could be applied to anti-circles
Nice! I also much prefer this solution so I'll merge it.
Anti-circles are specified for each key in custom layouts, not according to the symbols on the key. The mappings don't apply here.
fair enough - just thought it could be convenient to avoid having to specify anticircles on all my keys to match the gestures/fn keys, but it's nbd whatsoever