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.87k stars 838 forks source link

Make any letter as modifier with quick typing (e.g. hold "a" become shift) #2442

Open philipyoungg opened 4 years ago

philipyoungg commented 4 years ago

Keyboard layout:

QWERTY

Goal:

minimize finger movement as stretching out them strained me too much.

Problem I got from my code:

Code:

{
            "description": "Hold a to Left Shift",
            "manipulators": [
              {
                "from": {
                  "key_code": "a",
                  "modifiers": {
                    "mandatory": [],
                    "optional": ["caps_lock"]
                  }
                },
                "parameters": {
                  "basic.to_delayed_action_delay_milliseconds": 200,
                  "basic.to_if_held_down_threshold_milliseconds": 200
                },
                "to_delayed_action": {
                  "to_if_canceled": [
                    {
                      "key_code": "a",
                      "modifiers": []
                    }
                  ]
                },
                "to_if_alone": [
                  {
                    "halt": true,
                    "key_code": "a",
                    "modifiers": []
                  }
                ],
                "to_if_held_down": [
                  {
                    "halt": true,
                    "key_code": "left_shift"
                  }
                ],
                "type": "basic"
              }
            ]
          },
stale[bot] commented 3 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.

dxlr8r commented 3 years ago

Had the same issue, I got it working, I think, by adding:

"parameters": {
    "basic.to_if_alone_timeout_milliseconds": 50,
    "basic.to_if_held_down_threshold_milliseconds": 300
},
"parameters": {
    "basic.to_delayed_action_delay_milliseconds": 301
},
GanZhiXiong commented 2 years ago

I want to implement this too, do you have a final method?

dxlr8r commented 2 years ago

I never got it working. I have converted to programmable keyboards and Hammerspoon.

GanZhiXiong commented 2 years ago

It seems difficult to achieve, thank you for your quick reply.

GanZhiXiong commented 2 years ago

@philipyoungg Although it's been so long, I still want to ask you, do you have a solution? Because I would love to make it happen.