pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful tool for customizing keyboards on macOS
https://karabiner-elements.pqrs.org/
The Unlicense
18.93k stars 839 forks source link

Websites not recognizing keyboard shortcuts #2826

Open Marvin182 opened 3 years ago

Marvin182 commented 3 years ago

I'm using Karabiner Elements to get the Neo2 layout. I have the following rules: Neo2 layer 4 Neo2 layer 6 Neo2 mod 3 and 4 keys (Apple keyboard) Toggle caps_lock by pressing left_shift + right_shift at the same time

Generally this is working great and in most application I can type just fine. However an increasing number of website define hotkeys that rely on "?" or "/" and those don't work for me. I can add the rule "Prevent problematic keys from being treated as option key shortcut" to fix some of the shortcuts but then it will prevent me from typing normal "?", "/", etc. everywhere else.

I'm new to Karabiner-Elements. How does this work? Can we do something about this in Karabiner-Elements or are the website listen for the wrong keys?

MuhammedZakir commented 3 years ago

I don't use those modifications, so can't get a clear picture of your problem. If I understand it correctly, your /, and ? are remapped using Neo2 layer rule, but you don't want that to happen when you use browser? If that's not the case, please give more details.

Marvin182 commented 3 years ago

Not quite. I have a problem with how programs (mostly websites) detect hotkeys. Either they will not detect keyboard shortcuts or detect them when I want to write a certain character.

Examples:

I'm using Chrome but the same happens with other browsers (I tried Firefox and Safari). Pretty much all of the problems go away when I switch to a US keyboard layout and turn off Karabiners. But I very much prefer using the Neo2 layout.

Since this is not consistent between applications and mostly happens on Web Apps I think it's a problem which how Web Apps detect keyboard shortcuts and if there is anything we can do about it.

MuhammedZakir commented 3 years ago

Using Option to insert characters cause problems most of the times as it may trigger some shortcuts. For this, inserting character using AppleScript is much better (but will be slightly slower).

  • Visual Studio in the browser will let me write code just fine but almost any shortcut is swapped with something else. Typing "s" is fine but pressing cmd+s will trigger the keyboard shortcut cmd+h.

I am confused about this one. What is the output of EventViewer when you press command+s in the VS (in browser?)? What is the output when you press them in other apps?


I forgot to ask

  1. Which input layout do you use?
  2. Your keyboard type - ANSI, ISO or JIS?
  3. Neo2 rules you are using are from this config [1], right?

[1] https://github.com/pqrs-org/KE-complex_modifications/blob/main/public/json/neo2.json

Marvin182 commented 3 years ago

If I press command+s the EventViewer will always show:

type:down            HID usage:7,227      name:{"key_code":"left_command"}                             misc:flags left_command
type:down            HID usage:7,11       name:{"key_code":"h"}                                        misc:flags left_command
type:up              HID usage:7,11       name:{"key_code":"h"}                                        misc:flags left_command
type:up              HID usage:7,227      name:{"key_code":"left_command"}                             misc:

(In Neo2 the "s" is where you traditionally have the "h".) But somewhere in the stack the Mac keylayout does its job and most programs will see this as command+s and just work. But Visual Studio sees it as command+h.

I might have 2 separate problems: A) For Visual Studio in the browser the Mac keylayout doesn't do its job and all letters are messed up. B) All other application work fine for simple hotkeys (modifier + letter) but things that involve the 3rd layer in Neo2 fail because the Neo2 rules use Option to trigger the 3rd layer.

Do you agree?

For your questions:

  1. The neo.keylayout linked on https://neo-layout.org/Download/
  2. Germany keyboard layout (en.wikipedia.org/wiki/German_keyboard_layout)
  3. Yes
MuhammedZakir commented 3 years ago

A) For Visual Studio in the browser the Mac keylayout doesn't do its job and all letters are messed up.

I don't know what causes this problem. I'll see if I can test your setup, and report here once that's done.

B) All other application work fine for simple hotkeys (modifier + letter) but things that involve the 3rd layer in Neo2 fail because the Neo2 rules use Option to trigger the 3rd layer.

Using Option to insert special/unicode chars can create a big mess as keyboard shortucts may interfere when you type them. For inserting special chars, I recommend you to use Karabiner to map those keys to insert special chars using an AppleScript, or using clipboard.


I am consufed about "Visual Studio in browser". What exactly does it mean?

danielStrobl commented 3 years ago

I have the same issue with Jupyterlab in any browser using the Neo rules in Karabiner elements. If I try to type = or : as CAPSLOCK - F and CAPSLOCK - T respectively, Jupyter seems to catch these keys before they are recognized as a letter.

MuhammedZakir commented 3 years ago

Normally, without Karabiner, do you have to press Option to type those letters?

danielStrobl commented 3 years ago

I haven't used this layout without karabiner yet, but I just tried and apparently that is the case.

MuhammedZakir commented 3 years ago

I haven't used this layout without karabiner yet, but I just tried and apparently that is the case.

If so, then it's not a problem with Karabiner itself. I suspect some shortucts (JupyterLabs'?) are interfering in your case.

Using Option to insert special/unicode chars can create a big mess as keyboard shortucts may interfere when you type them. For inserting special chars, I recommend you to use Karabiner to map those keys to insert special chars using an AppleScript, or using clipboard.

danielStrobl commented 3 years ago

Thanks for your help! That's unfortunate, then I'll try to disable these shortcuts.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

xiang-li-unit8 commented 2 months ago

I (Neo + Karabiner + Mac) have the same problem on some websites and found the solution: Open Karabiner -> Complex Modifications -> Add predefined rule -> Select „Prevent all layer 3 keys from being treated as option key shortcut“ (für alle Tasten), or „Prevent problematic keys (?, /, #, =, and '?') from being treated as option key shortcut“ (für eine Auswahl von häufig problematischen Tasten).

This solution is explained in https://www.neo-layout.org/Einrichtung/macOS/.