📝

Karabiner-Elementsを使ってZettlrを使っているとき左⌘をmeta keyに割り当てる

2020/10/13に公開

設定ファイルは以下

{
  "title": "Switch left-command and left-option in Zettlr",
  "rules": [
    {
      "description": "Change left-command to left-option in Zettlr",
      "manipulators": [
        {
          "from": {
            "key_code": "left_command",
            "modifiers": {
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "left_option"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "japanese_eisuu"
            }
          ],
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": ["com.zettlr.app"]
            }
          ]
        }
      ]
    },
    {
      "description": "Change left-option to left-command in Zettlr",
      "manipulators": [
        {
          "from": {
            "key_code": "left_option",
            "modifiers": {
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "left_command"
            }
          ],
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": ["com.zettlr.app"]
            }
          ]
        }
      ]
    }
  ]
}

bunlde id は以下の方法を使って確認

$ lsappinfo info -only bundleid Zettlr
"CFBundleIdentifier"="com.zettlr.app"

以上

Discussion