How to map CTRL + Left Arrow to Home with Karabiner-Elements

karabinerkeyboard

I'm using Karabiner-Elements to map some keys with an external PC keyboard. I'd like to map CTRL + Left Arrow to Home and CTRL + Right Arrow to End. Is it possible to do this?

There's a complex rule for download that maps SHIFT + Left Arrow to End but I'm using CTRL.

Thanks!

Best Answer

You'd have to manually edit ~/.config/karabiner/karabiner.json with e.g. BBEdit or TextEdit (better make a backup copy before you start!).

Be aware: your re-mapping would de-activate Apple's Spaces-switching feature!

Anyway, doing so you'd have to go to

"rules": [

and (assuming you mean the right control key) add s.th. like:

"rules": [
    {  "description": "Call it whatever you like…",
       "manipulators": [ {
                "type": "basic",
                "from": {
                    "key_code": "left_arrow",
                    "modifiers": {
                        "mandatory": [
                            "right_control"
                        ]
                    }
              },
              "to": [
                  {
                      "key_code": "home"
                  }
              ]
          },
          {
              "type": "basic",
              "from": {
                  "key_code": "right_arrow",
                  "modifiers": {
                      "mandatory": [
                           "right_control"
                      ]
                  }
              },
              "to": [
                  {
                      "key_code": "end"
                  }
              ]
          }
      ]
  }
]

Be aware that the right order and correct corresponding of open and closed brackets of both types is essential! (As far as I can see there is no way to debug this behaviour; maybe apart from watching Karabiner-Element's open Window while saving the json-file. Your choice of editor can help though, even BBEdit can identify pairs of brackets …)

If what you did is correct, the new behaviour will work instantaneously once you saved the file!

So, if yours is the only Complex Modification, the closing "comma" must NOT be used here … but if you add yours to all previous ones this "comma" must instead be placed in front of your code (meaning: behind the last rule's finishing bracket. … a bit tricky, this all.

Related Question