2
2

More than 1 year has passed since last update.

ijklを矢印キーに切り替える(mac編)

Last updated at Posted at 2023-01-13

はじめに

前回windowsでijklを矢印キーに切り替える方法を紹介しましたが、今回はmacのやり方を紹介します。

やること

右commandもしくは右optionでijklを矢印キーに切り替えていこうと思います。なんでこの二つのキーに切り替えを割り当てるのかといういうと、macのキーボードを使う場合はスペースバーの右のキーがcommandで、外付けのキーボードを使う場合はスペースバーの右のキーがoptionに割り振られているからです。このへんは自分の好みのキーで設定してもらえればいいと思います。あとついでにcaps lockをcommandに割り振りたいと思います。

材料

必要なものはKarabiner-Elementだけです。macは装飾キーの割り振りが設定から簡単に変えることができるので嬉しい。

設定

まず装飾キーの設定をしていきましょう。設定->キーボード->キーボードショートカット->装飾キーから設定できます。
私はこのようにしています。
スクリーンショット 2023-01-13 2.19.31.png
caps lockは全く使わないのでそもそも設定していません。


では次にKarabiner-Elementの設定をしていきましょう。
インストールして起動するとこのような画面が出てくると思います。
image.png
Simple ModificationsやComplexModificationsである程度設定できるのですが、せっかくなのでスクリプトを書いて設定してみましょう。
Misc->Open config folderを開いてasset->complex_modificationsの中のファイルを開いてください。テキストエディタならなんでもいいです。
まずtitleとdescriptionを適当に変えておいてください。わたしはcustom_keyboard_layoutにしておきました。
そんでrulesの中のmanipulatorsを書き換えていくのですが、例えば右option+jを左矢印キーに割り当てるには

"manipulators": [
        //option ijklm.
        {
          "type": "basic",
          "from": {
            "key_code": "j",
            "modifiers": {
              "mandatory": ["right_option"],
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "left_arrow"
            }
          ]
        }
      ]

こんな感じに記述します。
なので全部の矢印キーについて書くと

"manipulators": [
        //option ijklm.
        {
          "type": "basic",
          "from": {
            "key_code": "j",
            "modifiers": {
              "mandatory": ["right_option"],
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "left_arrow"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "k",
            "modifiers": {
              "mandatory": ["right_option"],
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "down_arrow"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "i",
            "modifiers": {
              "mandatory": ["right_option"],
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "up_arrow"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": ["right_option"],
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "right_arrow"
            }
          ]
        }
      ]

こんな感じになるわけです。
commandキーを切り替えに割り振りたい時はright_optionをright_commandにしたものをさらに追加すればいいというわけですね。
では保存してKarabiner-elementsのほうに戻りましょう。
Complex_Modification->Add ruleを選択すると先ほど先ほど設定した名前の選択肢があると思います。スクリーンショット 2023-01-13 2.42.56.png
これをEnableにすれば完了です。

終わりに

というわけでmacのほうでijklを矢印キーに切り替える方法をご紹介いしました。Karabiner-Elementは結構いろんなことができるっぽいので興味のある方はぜひ調べてみてください。

では〜

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2