2

I have this problem (again) - pressing one key (b for me) sometimes makes it to be registered twice. https://discussions.apple.com/thread/7840547

Is there a way to use karabiner-elements to modify such that when a key is pressed twice within a short time the second key will not be registered? https://pqrs.org/osx/karabiner/complex_modifications/

  • Possible duplicate of Keyboard key stuck or not being recognized; how to fix – Allan Aug 19 '18 at 10:33
  • Karabiner remaps, it doesn't modify key behavior. In other words, if you remap a key and press it twice, it will execute the remap twice. You have a hardware problem and the keyboard needs to get fixed. Apple has a repair program specifically for this. – Allan Aug 19 '18 at 10:36
  • Thanks for the link. I think I found out Karabiner from that link also. This question is however specifically about Karabiner. Given the same key behaviour (a key is detected to be pressed in quick succession), how can make my applications recognise that the key is being pressed once only? – HK Tong Aug 19 '18 at 11:42
  • You can't. See my previous comment. – Allan Aug 19 '18 at 11:57
  • Yes, you CAN. See my answer below. – clemsam lang Oct 6 '18 at 9:51
1

For your special case I would suggest you use Karabiner Elements. and edit its ~/.config/karabiner/karabiner.json this way (added to/after "rules"):

EDIT / fail-safe version:
– Copy/paste the code below into TextEdit and "Save as..." WhateverNameYouLike.json
– Next manually move a copy to ~/.config/karabiner/assets/complex_modifications/
– Finally import from KE: tab "Complex Modifications", buttons [+ Add rule] & [+ Enable]

{ "title": "Keep solitary letter/key ''b'' from multiple press!",
  "rules": [
     { "description": "Keep 'b' from being pressed twice",
       "manipulators": [
        { "from": { "key_code": "b" },
          "parameters": {"basic.to_if_held_down_threshold_milliseconds": 10},
          "to_if_held_down":[
                 { "key_code": "b",
                   "repeat": false }],
          "type": "basic"
                }  
            ]
        }
    ]    
}

As you can see letter "b" is NOT re-mapped but in "to_if_held_down" kept from being repeated by "repeat": false; obviously letter 'b' may be substituted with any other failing letter.
(The threshold is defined to a minimal 1/100 second, so you won't notice any difference ...)

Please report if this code does for you what it's supposed to do.
[EDIT:] This solution works for the user in (ex-) trouble.
(I had to simulate the situation by testing in an app that does repeat keys if held down – but actually yours may be a non-solvable mechanical problem …)

Note:
This method, though, may not be advisable/applicable, if the holding-down of a key (e.g.: "a") in an app opens a small window above it offering (e.g.:) "ä" / "å" / "ậ" or similar choices – IF you need those special characters.
This behaviour would be prevented by "repeat": false.
But then:
You can activate "Show Keyboard & Character Viewers in menu bar" in System Preferences and get them from the menu bar...

  • Thanks understanding my question, and validating that my question is valid. However my problem is not solved, nothing seemed to have changed. This is my karabiner.json currently: gist.github.com/tonghuikang/a7d65b98e30f6f37765e696f8e8dd4da – HK Tong Oct 7 '18 at 15:14
  • Hi, I just looked into your json file – and saw that you actually have THREE instances of "Complex Modifications" where ONE is absolutely sufficient. Then, you did not paste the whole "function" above as ONE PIECE. … So. I pasted a version at your gist.github.com/tonghuikang/a7d65b98e30f6f37765e696f8e8dd4da . Try that one! – clemsam lang Oct 7 '18 at 23:48
  • This works, thanks! I changed from "10" to "1", it seems to work more reliably too. – HK Tong Oct 11 '18 at 14:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .