pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.79k stars 838 forks source link

deadlock: grave_accent_and_tilde and non_us_backslash events should not be modified #2514

Open lauhub opened 3 years ago

lauhub commented 3 years ago

Context

I need to use Karabiner to modify some events for some apps, but it also change events that should not be modified.

Although there are some workarounds, they do not work for me because they lead to a deadlock using some applications (I can't type some characters I need like > or <).

Hardware and software

Software

Keyboard layout

I use a french keyboard layout (default for the system)

Hardware

I have two keyboards that work well :

Problem description

Target keys

The problem is with @ and < keys.

French keyboard layout

Expected behaviour

When Karabiner is off (or if I disable event modification for a keyboard) here is what I get when I press these keys:

Key Event (Karabiner-EventViewer) Result (displayed character)
@ grave_accent_and_tilde @
Shift + @ grave_accent_and_tilde flags:left_shift #
< non_us_backslash <
Shift + < non_us_backslash flags:left_shift >

Actual behaviour

The problem comes when I run Karabiner-Elements (the expected result should be the same displayed character as in the previous table):

Key Event (Karabiner-EventViewer) Result (displayed character)
@ grave_accent_and_tilde <
Shift + @ grave_accent_and_tilde flags:left_shift >
< non_us_backslash @
Shift + < non_us_backslash flags:left_shift #

Non-working workaround

I am aware that adding simple modification like this will solve the problem in most cases:

From Key To Key
grave_accent_and_tilde non_us_backslash
non_us_backslash grave_accent_and_tilde

Deadlock

But this should not be necessary because Karabiner modifies the default behaviour although it is not needed.

I tried to reset entirely KE configuration files and the result is the same: default keyboard behaviour is modified.

As I use KE to generate the correct keys when I connect remotely to a Windows machine, it does not allow me to generate < and > characters when I press the < key, whatever the complex modification I use.

Proposed solution

Karabiner-Elements should not replace keys nor revert these keys unless explicitely defined by user. When it is ran, by default:

michelschinz commented 2 years ago

For what it's worth, I have exactly the same issue with a MacBook equipped with a Swiss-French internal keyboard (which works fine) and an external Microsoft Natural Ergonomic Keyboard 4000 (also Swiss-French mapping). That is, the external keyboard works normally as long as Karabiner-Elements is not run, but as soon as Karabiner-Elements is started, the keys grave_accent_and_tilde and non_us_backslash are swapped on that keyboard only (they still work normally on the internal keyboard).

I also use the workaround mentioned above, but I still think the issue should be solved as I'm pretty sure anyone with a similar setup runs into this, and diagnosing the problem takes quite some time.

Thank you!

giuliomoro commented 1 year ago

I have what I think is the same problem. On a macbook with EN/GB keyboard, simply enabling "modify events" without having any Simple or Complex modifications enabled on the internal keyboard swaps the behaviours of the `~ key with that of the §± key. Pretty annoying.

giuliomoro commented 1 year ago

I set the virtual keyboard setting to ANSI (North America, most of Asia and others), despite having a EN/GB primary keyboard and Spanish Latina America external keyboard and this seems to have fixed it without the need for the custom rules suggested in https://github.com/pqrs-org/Karabiner-Elements/issues/2985#issuecomment-1030882915.

This issue is so widespread that it seems like it would need better documentation and communication, but I am not sure where this could go.