2

So I'm new to Karabiner, and I'm trying to swap the command and control key only when I'm in iterm2. Here's the json file I came up with. Currently it swaps the control key to a command key but does not switch the command key to a control key.

{
  "title": "CTRL/CMD Key Swap",
  "rules": [
    {
      "description": "swap left control/command keys for iterm2",
      "manipulators": [

        {
          "type": "basic",
          "from": {
            "key_code": "left_command"
          },
          "to": {
            "key_code": "left_control"
          },
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.googlecode\\.iterm2$"
              ]
            }
          ]
        },
         {
          "type": "basic",
          "from": {
            "key_code": "left_control"
          },
          "to": {
            "key_code": "left_command"
          },
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.googlecode\\.iterm2$"
              ]
            }
          ]
        }
      ]
    }
  ]
}

How can I swap the command and control key only when I'm in iterm2 app?

0

1 Answer 1

0

You need to make them two separate rules, one for changing ctr to command and another to change command to ctrl.

"rules": [
    {
        "description": "LCtrl => LCommand [+Iterm2]",
        "manipulators": [
            {
                "conditions": [
                    {
                        "bundle_identifiers": [
                            "^com\\.googlecode\\.iterm2$"
                        ],
                        "type": "frontmost_application_if"
                    }
                ],
                "from": {
                    "key_code": "left_control"
                },
                "to": [
                    {
                        "key_code": "left_command"
                    }
                ],
                "type": "basic"
            }
        ]
    },
    {
        "description": "LCommand => LCtrl [+Iterm2]",
        "manipulators": [
            {
                "conditions": [
                    {
                        "bundle_identifiers": [
                            "^com\\.googlecode\\.iterm2$"
                        ],
                        "type": "frontmost_application_if"
                    }
                ],
                "from": {
                    "key_code": "left_command"
                },
                "to": [
                    {
                        "key_code": "left_control"
                    }
                ],
                "type": "basic"
            }
        ]
    }
]

You must log in to answer this question.

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