hirakiucの日記

いろいろ

karabiner-elements(12.0.0)を使って1keyで日本語入力をtoggleする方法

karabiner-elements12.0.0を使って、1keyで日本語入力をtoggleする方法。

設定

以下を ~/.config/karabiner/assets/complex_modifications/custom.jsonとして保存

{
  "title": "Japanese input config",
  "rules": [
    {
      "description": "Toggle input source by right command",
      "manipulators": [
        {
          "conditions": [
            {
              "type": "input_source_unless",
              "input_sources": [
                {
                  "language": "ja"
                }
              ]
            }
          ],
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_command"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "japanese_kana"
            }
          ]
        },
        {
          "conditions": [
            {
              "type": "input_source_if",
              "input_sources": [
                {
                  "language": "ja"
                }
              ]
            }

          ],
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "any"
              ]

            }
          },
          "to": [
            {
              "key_code": "right_command"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "japanese_eisuu"
            }
          ]
        }
      ]
    }
  ]
}

Preferences -> Complex Modifications の RulesタブからAdd ruleを選択して、Japanese input configToggle input source by right commandをEnableする。

あとは、Right Commandを使うことで英数 <-> かなのtoggleができるはず。

参考