Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As my sibling commenter said, use Karabiner Elements if you are on macos. Though it's not an out-of-the-box thing.

Add this config to ~/.config/karabiner/assets/complex_modifications/custom-capslock.json

    {
      "title": "Change caps_lock to Esc and Control",
      "rules": [
        {
          "description": "Post Esc if Caps is tapped, Control if held.",
          "manipulators": [
            {
              "type": "basic",
              "from": {
                "key_code": "left_control",
                "modifiers": {
                  "optional": [
                    "any"
                  ]
                }
              },
              "to": [
                {
                  "key_code": "left_control",
                  "lazy": true
                }
              ],
              "to_if_alone": [
                {
                  "key_code": "escape"
                }
              ]
            }
          ]
        }
      ]
    }
and then in the GUI enable it in the Complex Modifications tab. Last you need to map "capslock" to "left_control" in the Simple Modifications tab.


Ooh! Can I do this with "z" and "/" (letter if tapped, control if held)?


My GUESS is that it would be something like this:

    {
      "title": "Hold z or / for control",
      "rules": [
        {
          "description": "Hold z for control",
          "manipulators": [
            {
              "type": "basic",
              "from": {
                "key_code": "z",
                "modifiers": {
                  "optional": [
                    "any"
                  ]
                }
              },
              "to_if_alone": [
                {
                  "key_code": "left_control"
                }
              ]
            }
          ]
        },
        {
          "description": "Hold / for control",
          "manipulators": [
            {
              "type": "basic",
              "from": {
                "key_code": "/",
                "modifiers": {
                  "optional": [
                    "any"
                  ]
                }
              },
              "to_if_alone": [
                {
                  "key_code": "right_control"
                }
              ]
            }
          ]
        }
      ]
    }


Yep! You can do whatever you want with complex modifications. The only tricky part is figuring it out. It shouldn't be TOO different than the above if you replace the appropriate values.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: