DreymaR/BigBagKbdTrixXKB

Problems with multi-key mappings

Opened this issue · 11 comments

snth commented

Hi,

Your extend layer is amazing! Thank you!

I made a few modifications for my own. I actually tried a lot of variations and for a lot of them I came back to your original mappings. Some of them I am keeping for now. Happy to share or pull request if you're interested.

Anyway, they all work great on my Windows laptop with PKL. However on my Linux box a lot of the multi-key mappings don't work. In particular Alt+Tab and most of the Alt+? , Shift+? and Ctrl+? mappings.

Do you have any experience or suggestions for going about trying to resolve these problems? I have a Microsoft Ergonomic keyboard in case that makes any difference. I don't know if that doesn't handle simultaneous scancodes properly or something like that. Any comments would be appreciated.

Thanks again for making this available!

Thanks for the praise! It's much appreciated.

Feel free to divulge the Extend modifications you feel are most beneficial to you. Maybe you'll give the rest of us some good ideas? You could also start a topic in the Colemak Forums if you like.

Since there's a lot of changes in the symbols/extend file, it's going to be a bit hard to see where you went wrong. :-) Point out a specific problem, please?

Your keyboard type should make no difference here.

As you can see from my extend file, it's indeed hairy business. Check out how I solved the Undo/Cut/Copy/Paste keys for an example. You have to both map the keys and provide actions for them (the action being the most important part it appears) but it seems you've understood that already.

Not sure how an Alt-Tab mapping will work in XKB. Might not do what it's supposed to...?

snth commented

Thanks for the response.

You can see my changes here: https://github.com/snth/BigBagKbdTrixXKB/blob/extend-snth/x-mod_v2-17-1ub1_2016-06-06/xkb/symbols/extend

I mostly just moved your entries from one key to another. I don't really understand what the action modifiers do.

The problem I'm having is that often even simple combinations don't work, for example ALT+. In my mapping that corresponds to pressing Qwerty keys CAPSLOCK+A+J.

My mapping for { is CAPSLOCK+D+, which works. Previously I had it on the M key in the extend layer and that didn't work. I suspect because it also requires the shift modifier by pressing D. So now I have ( on the M key because the shift modifier doesn't work on that key and I haven't got anything overloaded for SHIFT+(.

As I said, you must pay attention both to the mappings and the actions of each key state. Look closely at what I've done for Extend+C (Ctrl+C) for instance. The action may be necessary to get the correct shift state on the remapped key stroke.

To remap to glyphs such as 'braceleft' is simple though. I usually do that on the AltGr layers since I consider Extend1 primarily a key remapping layer and not a glyph mapping layer. But on Extend2 (my NumPad layer on lv8) I have some symbol mappings.

You've mapped braces to the shifted state of the comma key, so indeed you'll have to press a Shift (physical or Extend-mapped) to get braces.

snth commented

Ok I see. So if I just look at ALT key in Extend mode as an example, what layers or modifier states do the 4 entries for each key correspond to?

    key <AC01> { symbols[Group1]=[ NoSymbol , NoSymbol , NoSymbol , NoSymbol ,
                   Alt_L                , Alt_L                 , // Alt
                   space                , nobreakspace         ], // Space
                 actions[Group1]=[NoAction(),NoAction(),NoAction(),NoAction(),
                   SetMods(mods=Alt)    , SetMods(mods=Alt)     , // Alt mod for <LALT>
                   NoAction()           , NoAction()           ]
               };  // Cmk A

Right. In that example, the first four shift states (normal, Shift, AltGr, Shift+AltGr) are left alone. The next four are the same but with Extend, which is implemented in XKB as a level5 modifier.

So the lines with Alt_L and mods=Alt are Extend and Extend+Shift.

snth commented

Ok, so perhaps what I need to do then is to set the mod for the shift state so that it becomes SetMods(modsAlt,Shift). Any reason why you didn't do that? I don't want to have to rediscover lessons you have probably learned already.

Under PKL this all works as expected, I guess because you're using VirtualKeys?

I think you may be confused? Sorry, but I cannot teach you all of xkb syntax. Please read up on it if you want to learn. Your example is malformed. I think what you wanted was SetMods(mods=Alt+Shift).

But I don't understand exactly what you want to do? Setting the Shift mod for the shifted state is unnecessary as the Shift mod has to be set already to access the shifted state of a key!

snth commented

Aha, thank you for your explanation.

Yes, sorry I was taking advantage of your expertise in this area.

Thanks again for putting this all together and making the extend layer available on Windows and Linux!

Tell me what exactly you're trying to do, and maybe I can help.

Example: You want key A+modB to happen when you press Extend+C+D. Or you want symbol X with a certain key combo.

snth commented

Ok, thanks. You've been a great help already so not expecting you to look into this. If you are curious, here are some problems I experience in routine use:

  • Extend+A+I or Extend+A+K should be Alt+Up and Alt+Down also in your extend layer, as I didn't remap those. For example in the Slack app this is used to go to the previous or next channel. This doesn't work for me on Linux. Works fine in PKL.
  • Extend+A+D+I or Extend+A+D+K: Same as above but go to previous/next unread channel in Slack.
  • Extend+F+: I've mapped Extend+\ to 1 in my layer so this should go to the first tab in Chrome but doesn't work for me. Works fine in PKL.
  • Extend+A+': This should be Alt+Tab. Extend+' as Tab works when editing text but the Alt+Tab combo doesn't work. I understand Alt+Tab may be special but this works on PKL.

Some of these are my remappings so I may not have done them correctly as I admit that I don't know XKB syntax at all and just cut and pasted your extend layer mappings. However the first two items I think are identical to your extend layer so you could test those.

I suspect it may be my keyboard though because my mapping for the { symbol didn't work when it was Extend+D+M but works fine when I moved it to Extend+D+< with the same xkb code. My keyboard is Microsoft Natural Ergonomic Keyboard 4000 v1.0. I think I saw on other forums that some keyboards don't handle multiple keypresses uniformly.

EDIT; It's worth pointing out that my PKL setup is on a laptop with the laptop keyboard while my Unix setup uses the Microsoft Ergonomic keyboard.

Well, it should be easy enough to plug in another USB keyboard to test your hardware hypothesis.

The Extend A(Alt) and UNEI(arrows) keys look correctly mapped, unchanged from mine. So the combo Ext+A+U should produce Alt+Up. If it doesn't, try with the physical Alt key (Alt+Ext+U) and see whether that makes a difference. The handling of Alt can be a bit strange at times.

As for the mapping of '1' on backslash: Looks innocent enough. I take it pressing Ext+\ alone does produce a '1' key press for you? To make sure it also works with modifiers, I'd consider also adding a redirect action, replacing the NoAction() entries of levels 5–8 with redirect(key=<AE01>).

As I said, I've no idea whether the Alt+Tab functionality is mappable in this way. One workaround may be to set Linux shortcuts for the functions you want!