Karabiner-Elements-Neo icon indicating copy to clipboard operation
Karabiner-Elements-Neo copied to clipboard

Does not work with external keyboards

Open hmeine opened this issue 7 years ago • 21 comments

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.

hmeine avatar Mar 02 '17 08:03 hmeine

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:

  • Layer 4:
    • right “Windows” key: works as M4, no issues
    • ><| key: acts as "dead ^" rather than M4 (like you describe) (EventViewer reports 0xa non_us_backslash)
  • Layer 3:
    • Capslock: works as M3, no issues
    • '# key: seems to have no effect instead of acting as M3 (EventViewer reports 0x2a backslash)

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 avatar Mar 02 '17 18:03 tjanson

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).

tjanson avatar Mar 02 '17 22:03 tjanson

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

  • Layer 4:
    • right "Windows" key: reported as 0x6e application, does not work as M4.
    • <>| key: 0xa non_us_backslash, same here.
  • Layer 3:
    • Capslock works, same here. (Even without changing the modifier keys in the Keyboard prefs panel, by the way.)
    • The '# key does not work as M3, EventViewer reports 0x2a backslash, same here.

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 avatar Mar 03 '17 10:03 hmeine

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

hmeine avatar Mar 03 '17 10:03 hmeine

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?

jgosmann avatar Mar 04 '17 21:03 jgosmann

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:

  • non_us_backslashright_command (left M4)
  • grave_accent_and_tildenon_us_backslash (dead key above Tab for various diacritics)

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.

tjanson avatar Mar 04 '17 21:03 tjanson

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.

hmeine avatar Mar 06 '17 07:03 hmeine

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

  • Right windows key as mod4?
  • The # key does not work as right mod3?

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?

jgosmann avatar Mar 18 '17 21:03 jgosmann

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:

neominik avatar Mar 28 '17 13:03 neominik

@jgosmann Yes, you are right:

  • Right windows key gives 0x6e, and is doing something like "cursor up" in terminals.
  • The # key gives 0x2a backslash and does not have a modifier effect.

hmeine avatar Mar 28 '17 13:03 hmeine

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?

jgosmann avatar Mar 28 '17 15:03 jgosmann

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

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

hmeine avatar Mar 29 '17 06:03 hmeine

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

jgosmann avatar Mar 29 '17 14:03 jgosmann

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:

Phylu avatar May 17 '17 08:05 Phylu

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

jgosmann avatar May 22 '17 15:05 jgosmann

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

Phylu avatar May 22 '17 19:05 Phylu

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.

TaucherMK avatar Sep 16 '17 10:09 TaucherMK

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.

tim6her avatar Sep 17 '17 07:09 tim6her

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.

jgosmann avatar Oct 08 '17 16:10 jgosmann

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

Phylu avatar Oct 09 '17 19:10 Phylu

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:

  • Complex Modifications: All Neo Rules imported from the website
  • Simple Modifications for USB Keyboard only (my external keyboard) ** non_us_pound -> caps_lock to have the '#' working as modifier ** (right_potion --> right_command to switch the right command and option keys as the windows keyboard has these keys switched)

Phylu avatar Oct 16 '17 07:10 Phylu