jgosmann / Karabiner-Elements-Neo

Neo2 Layer 4/6 for macOS Sierra
The Unlicense
33 stars 5 forks source link

Does not work with external keyboards #15

Open hmeine opened 7 years ago

hmeine commented 7 years ago

First of all, thanks for finally being able to use layer 4 on my MBA/Sierra again. However, I'd like to report / discuss that this does not work with external keyboards. I like to keep my MBA closed, with two setups in two different offices:

  1. Power adapter + thunderbolt, with ethernet, graphics, and USB hub via the monitor / thunderbolt cable. Mouse, keyboard etc. connected via that USB hub.
  2. Power adapter + displayport graphics + USB KVM switch. (Although the same type of Microsoft keyboard is connected, its USB identifier is "hidden" by the KVM switch.) In both settings, I am getting a "dead ^" with the mod4-key (leading to ĥ instead of 7, ^m instead of 1, ⁿ instead of 4).

I'd like to know whether it's a well-known limitation, a bug, or a misconfiguration on my side.

tjanson commented 7 years ago

I don’t usually use an external keyboard, but I gave it a try with a “Cherry Stream 3.0” USB keyboard (German ISO keys). My results:

Is this exactly the behavior you’re seeing?

The fact that the right M3 isn’t working (for me) seems to indicate a problem with the layout file, not the Karabiner Elements implementation.


screen shot 2017-03-02 at 23 08 05
tjanson commented 7 years ago

Remapping non_us_backslash to right_command fixes the Layer 4 issue, at least for the keyboard I have.

Oddly enough the Layer 3 issue remains despite the fact that backslash is remapped to right_option already (without this, both internal and external keyboard seem to emit 0x2a backslash, but redirection only works for the internal one).

hmeine commented 7 years ago

Now that I am back in my office, I try to answer as best as I can:

This is with my KVM switch, which reports a generic "USBKBM" (according to the Keyboard prefs). Maybe that's relevant for the right "Windows" key?

What's also very interesting is that I tried the on-screen keyboard overlay, and it changes the layout back and forth between a full layout with numpad and a reduced notebook-style layout depending on the keys I press (e.g. right Windows, #). (Again, possibly related to the generic USBKBM identifier.)

hmeine commented 7 years ago

Furthermore, I can confirm that remapping non_us_backslash to right_command fixes the Layer 4 issue, thanks for that!

jgosmann commented 7 years ago

Unfortunately, I do not have easy access to ISO style external USB keyboards. (I'm living in Ontario, Canada where most keyboards are ANSI style US keyboards; though it is possible to get ISO style French-Canadian keyboard if you specifically order them). I have a German bluetooth Apple keyboard which works properly.

Furthermore, I can confirm that remapping non_us_backslash to right_command fixes the Layer 4 issue, thanks for that!

What does the key left to the 1 key (above the tab key) produce (with and without that remapping, and what is the key code in the Karabiner-EventViewer)? Potentially the keycodes for that key and the left mod4 are swapped (I have a vague memory of hearing that this is sometimes the case ...).

I suppose the left mod4 issue can be fixed in most cases by remapping the correct key to right_command. So “fixing” this bug involves mainly updating the installation instructions.

The right mod3 issue is strange because it seems like the internal and external keyboard emit the same key code 0x2a backslash which should be remapped by Karabiner-Elements. I wonder if this could actually be an upstream issue, i.e. happens with a vanilla Karabiner-Elements, too?

tjanson commented 7 years ago

What does the key left to the 1 key (above the tab key) produce (with and without that remapping, and what is the key code in the Karabiner-EventViewer)? Potentially the keycodes for that key and the left mod4 are swapped (I have a vague memory of hearing that this is sometimes the case ...).

Looks like you’re right: Without any remapping, the external keyboard’s °^ produces 0x32 grave_accent_and_tilde, while ><| produces 0xa non_us_backslash — which is exactly the opposite of the internal one.

Thus the remapping for such external keyboards should include both:

As for the right M3 — I’m not sure, I haven’t tested that. Frankly, since @hmeine does not seem to have this problem (right?) and I don’t actually use external keyboards, I’d ignore the problem until someone else comes along that’s affected.

hmeine commented 7 years ago

For the right M3 (#'), I do have the same issue as you. Interestingly, when I disable event mapping for both keyboards, I am getting the same 0x2a backslash on both. When I enable the mappings, only the internal keyboard's backslash key is successfully mapped:

eventType:FlagsChanged    code:0x3d       name:right_option    flags:Opt                                misc:characters:    
eventType:FlagsChanged    code:0x3d       name:right_option    flags:                                   misc:characters:    
eventType:KeyDown         code:0x2a       name:backslash       flags:                                   misc:characters:    
eventType:KeyUp           code:0x2a       name:backslash       flags:                                   misc:characters:    

Concerning the M4 discussion, I cannot confirm that the codes are swapped. At least, when I uncheck both keyboards under "modify events from this device", I get nearly the same output from both keyboards, when first pressing , then <>:

External Keyboard (through KVM switch):

eventType:KeyDown         code:0xa        name:non_us_backslas flags:Caps                               misc:characters:    
eventType:KeyUp           code:0xa        name:non_us_backslas flags:Caps                               misc:characters:    
eventType:KeyDown         code:0x32       name:grave_accent_an flags:Caps                               misc:characters:    
eventType:KeyUp           code:0x32       name:grave_accent_an flags:Caps                               misc:characters:    

Internal Keyboard:

eventType:KeyDown         code:0xa        name:non_us_backslas flags:                                   misc:characters:    
eventType:KeyUp           code:0xa        name:non_us_backslas flags:                                   misc:characters:    
eventType:KeyDown         code:0x32       name:grave_accent_an flags:                                   misc:characters:    
eventType:KeyUp           code:0x32       name:grave_accent_an flags:                                   misc:characters:    

Interestingly, the external keyboard has different "flags" set.

jgosmann commented 7 years ago

@hmeine Can you remind me whether this is the list of things that do not work for you?

A few questions:

  1. Does your right windows key work as command key (without Karabiner)?
  2. What Karabiner-EventViewer display for the right windows key?
  3. Does the caps lock key on the external keyboard change the Caps flag?
  4. Does pressing both shift keys on the external keyboard at the same time change the Caps flag?
neominik commented 7 years ago

I have the same issue with the right # key on an older wired external german apple keyboard. 0x2a is reported on the external keyboard but not remapped as for the internal one, which emits the same key when karabiner is turned off.

eventType:KeyDown         code:0x2a       name:backslash       flags:                                   misc:characters:    
eventType:KeyUp           code:0x2a       name:backslash       flags:                                   misc:characters:
hmeine commented 7 years ago

@jgosmann Yes, you are right:

jgosmann commented 7 years ago

Can someone test whether the remapping of # with an external keyboard works with a normal Karabiner-Elements? I think this might be an upstream issue and I'm not familiar enough with the code base to fix this.

Is there a name displayed for the windows key in the Karabiner-EventViewer?

hmeine commented 7 years ago

No, there is no name displayed, that also surprised me.

ATM, I cannot test with a normal Karabiner-Elements, sorry.

jgosmann commented 7 years ago

Hm, that probably means that it is not possible to chose that key in a remapping in Karabiner-Elements at the moment.

Phylu commented 7 years ago

I have just tested the remapping with the latest Karabiner-Elements version. The remapping of the # on the external keyboard does not work there as well.

Here is the Karabiner Event Viewer output without any modifier settings for pressing # first on the internal and then on the external keyboard.

eventType:KeyDown         code:0x2a       name:backslash       flags:                                   misc:characters:
eventType:KeyUp           code:0x2a       name:backslash       flags:                                   misc:characters:
eventType:KeyDown         code:0x2a       name:backslash       flags:                                   misc:characters:
eventType:KeyUp           code:0x2a       name:backslash       flags:                                   misc:characters:

Here is the Karabiner Event Viewer with the remapping from \ to right_option set for pressing # first on the internal and then on the external keyboard.

eventType:FlagsChanged    code:0x3d       name:right_option    flags:Opt                                misc:characters:
eventType:FlagsChanged    code:0x3d       name:right_option    flags:                                   misc:characters:
eventType:KeyDown         code:0x2a       name:backslash       flags:                                   misc:characters:
eventType:KeyUp           code:0x2a       name:backslash       flags:                                   misc:characters:
jgosmann commented 7 years ago

In that case, can you open an issue upstream? Thank you!

Phylu commented 7 years ago

See: https://github.com/tekezo/Karabiner-Elements/issues/746

TaucherMK commented 7 years ago

I think it is fixed upstream. You just have to rewrite non_us_pound. This doesn't work with jgosman version right now though. Would be nice if you could update to current version of karabiner-elements.

tim6her commented 7 years ago

For all of you that cannot wait until this is matter is fixed: I bought an Apple Magic Keyboard 2 and it works like a charm. However, mapping non_us_backslash to right_command kills your circonflexe dead-key. So I removed this remap and left-Mod-4 still works for me.

jgosmann commented 6 years ago

Neo2 can now be used with the official upstream version of Karabiner-Elements. Just import and activate the required rules. Hopefully, that will resolve this issue.

Phylu commented 6 years ago

I will try this as soon, as I get back to my desk :)

Phylu commented 6 years ago

I just tested the issue and remapping non_us_pound works.

In combination with the Neo settings of the upstream version my Settings now look as follows: