Mac | Karabiner-Elements

Karabiner-Elements

Change an event if the frontmost application is the specified application.

Mac 上のwine で ctrl(control) と alt(command) を入れ替えたい。

~/.config/karabiner/assets/complex_modifications/ に以下のjsonを保存

swap_left_command_and_control.json

{
  "title": "swap left_command and left_control",
  "rules": [
    {
      "description": "swap left_command and left_control",
      "manipulators":
      [
        {
          "type": "basic",
          "from": {
            "key_code": "left_control"
          },
          "to": [
            {
              "key_code": "left_command"
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "file_paths": [
                "/opt/homebrew/bin/wine-preloader"
              ]
            }
          ],
          "description": "swap left_command and left_control"
        },

        {
            "type": "basic",
            "from": {
              "key_code": "left_command"
            },
            "to": [
              {
                "key_code": "left_control"
              }
            ],
            "conditions": [
              {
                "type": "frontmost_application_if",
                "file_paths": [
                  "/opt/homebrew/bin/wine-preloader"
                ]
              }
            ],
            "description": "swap left_command and left_control"
          }
      ]
    }
  ]
}

Karabiner-Elements から
Preferences... > Complex Modifications > Add rule
~/.config/karabiner/assets/complex_modifications/ に問題のないjsonファイルが入れてあれば、項目が表示される模様

参考

www.870labo.com

karabiner-elements.pqrs.org