calin-darie / extra-keyboard-layouts

To România and beyond!
MIT License
61 stars 36 forks source link

Neo2 layout #5

Closed AlexD97 closed 3 years ago

AlexD97 commented 3 years ago

Could you please add the german neo2 layout?

calin-darie commented 3 years ago

I think that only a half-baked solution can be done.

1. Modifier key code likely handled by OS

The main problem is that Neo requires a third modifier in addition to SHIFT and ALT_RIGHT. My first instinct was to use SYM, and the instinct was confirmed by this implementation in the official Neo repository

But the SYM key event is first handled by the OS in some cases, resulting for instance in the switch layout dialog popping up.

The same issue with META_LEFT / META_RIGHT, they might trigger for example the Google Assistant.

Maybe sacrificing the distinction between CONTROL_LEFT and CONTROL_RIGHT would do? I'd make both CTRL keys indistinguishable from each other e.g. both generate CONTROL_LEFT, and reassign CONTROL_RIGHT the role of a Level 3 modifier.

2. Lock by double modifier not possible in kcm

I could find no way to make two modifier keys simulate a lock e.g. SHIFT_LEFT + SHIFT_RIGHT => CAPS_LOCK Possible culprits:

I have the idea of making the windows key act as a SCROLL_LOCK key, and scroll lock could then replace SHIFT_LEFT + SHIFT_RIGHT. For layer 2 I think it's acceptable to have it non-lockable sometimes, so I'd make it available only if you have a physical scroll lock key.

3. Fallback mechanism prevents functioning of level 4 as long as it's not locked.

Again there's no way of making a modified key simulate another key's action directly, only direct output is possible. Any action must be attempted only as a fallback, so there we lose the entire level 4 navigation keys when level 4 is accessed via it's modifier (not locked)

Edit: Apparently it wasn't the fallback mechanism: ALT_RIGHT as modifier for Level 4, combined with the level 4 directional keys results in row-level or even page-level navigation and combined with backspace results in deleting an entire row. The same behavior occurs when you combine ALT_RIGHT with the regular direction keys in all the layouts included in the official Android repo. I couldn't circumvent this. Assigning none as action for ALTRIGHT + DPAD* arrow keys had no effect. Trying to use CTRL as modifier would result in a different special behavior e.g. CTRL + arrow left / right would skip entire words. SHIFT + arrow keys would actually perform selection in addition to cursor movement. So If only we could use the SYM key...

As a workaround, I'll try to create another layout, based on layer 4, and you'll have to toggle between layer 1 with crippled layer 4 to layer 4 with unavailable layers 1 & 2 by pressing CTRL+SPACE.

AlexD97 commented 3 years ago

I think points 1 and 3 are more important than point 2 (I could live without CAPS_LOCK). Nevertheless, your solutions seem fine to me.

calin-darie commented 3 years ago

I managed to work around 1. by interpreting both shift keys as SHIFT_LEFT, and using SHIFT_RIGHT instead of SYM. CONTROL_RIGHT + CVX was being handled by the system.

The work around for 2 also seems promising, I could use the start/windows key to lock / unlock level 4. That's why I don't need to attempt creation of a new layout based on level 4, you'll simply lock level 4 to use the left-hand direction pad.

calin-darie commented 3 years ago

In the end, the limitations are:

calin-darie commented 3 years ago

In the next couple of days I expect the update to be reviewed by Google so you can get it from Play Store.

Please reply with your feedback here.

AlexD97 commented 3 years ago

Thank you, the update is already on Play Store. Unfortunately, I'm not able to use Layers 3-6. Maybe the fault is on my tablet's side?

calin-darie commented 3 years ago

How do you connect the keyboard to the tablet?

And is none of the two M3 keys working? None of the two M4 keys? What exactly do you get as output?

AlexD97 commented 3 years ago

I have a Tab S7+ with the official keyboard. Basically for all modifier keys I get the capital letter. The problem is probably that I have no scrolllock key...

calin-darie commented 3 years ago

But you do have a start/CMD key, right? That one I have designated as scroll lock. Hit it once and enjoy level 4?

calin-darie commented 3 years ago

I'll send you another layout next week and I'll ask you for input from key event display to help us identify which modifier keys we can rely on.

geofaw commented 3 years ago

@AlexD97 I think you have a problem with you external keyboard. I testet v1.2.1 with "Microsoft Universal Foldable" keyboard (complete layers) and all layers are working. There are some little mistakes like layer 1 key c (should "ä" is "4") or layer 2 key w (should "W" is "w"), but in principle it is working very fine. I also tested a Logitech K480 (not every key) too and get the same behaviour like the MS foldable. All layers are working.

@calin-darie I found some more "mistakes" (not sure if really mistakes or not writeable signs in the editor on the phone - for example∈- layer 6 key g) respectively like you said about layer 4. At the moment it's no difference which mod4-key is used, but the behaviour of the cursor-keys or backspace or … is not as expected. Maybe no big issue and only a wrong mapping. The numpad on layer 4 is working well. What do you mean with "locking"? If I press and hold mod4 and press another key in addition I get the expected sign (works well). And if I press mod4 single time I get on-screen "menue" with special signs. A second press on mod4 and the "menue" disappears - in my opinion no problem here.

AlexD97 commented 3 years ago

@geofaw was right, the issue was on my side, but I fixed it now.

In general, the layers work. Probably the error for symbol ∈ is device-specific. For me ∈ works but some other greek letters don't. The locking with cmd works also fine. But if I use layer 4 with another modifier the behavior for cursor-keys is unexpected, like @geofaw already wrote. But that's probably due to the limitations which were mentioned before, isn't it?

calin-darie commented 3 years ago

@geofaw was right, the issue was on my side, but I fixed it now.

Maybe others will have the same issue, so can you share here what it was and how you've fixed it?

calin-darie commented 3 years ago

if I use layer 4 with another modifier the behavior for cursor-keys is unexpected, like @geofaw already wrote. But that's probably due to the limitations which were mentioned before, isn't it?

Yes. I can't find the official docs about this, but there are two ways to verify:

1 search online, I found this list of shortcuts https://www.pcworld.com/article/184656/android_keyboard_shortcuts.html

  1. Try it yourself. With any standard Android layout e.g. the default English US, try alt_right + arrow keys or alt right+ backspace and you'll see the same behaviour as unlocked level 4. Otherwise let me know
calin-darie commented 3 years ago

@geofaw

There are some little mistakes like layer 1 key c (should "ä" is "4") or layer 2 key w (should "W" is "w")

Thanks for the feedback, I'll publish a fix next week. Now I'm on vacation with no access to my dev environment

AlexD97 commented 3 years ago

@geofaw was right, the issue was on my side, but I fixed it now.

Maybe others will have the same issue, so can you share here what it was and how you've fixed it?

Some app (Key mapper) was interfering via the Android accessibility tools. Deactivating the app didn't help, I had to turn it off in the accessibility menu.

calin-darie commented 3 years ago

I've fixed W, ä, and an additional typo I've found on greek iota ι.

Try it out and let me know if it works for you.

AlexD97 commented 3 years ago

Thanks! I couldn't find any further issues :)

calin-darie commented 3 years ago

If you're happy with the layout, you may buy me a drink

Otherwise, let's reopen and fix.

Thanks for all the feedback!