Karabiner-Elements を使用し右コマンドキーを英数トグル用キーとして使う
Karabiner-Elements 単体で、タイトルの動きがようやく実現できたのでメモを残しておきます。
Complex_Modifications 機能の追加
Karabiner-Elements の Complex_Modifications 機能を使用します。
Complex_Modifications 用ディレクトリーを Finder で開いておきます。
$ open ~/.config/karabiner/assets/complex_modifications/
このディレクトリーに、以下の JSON ファイルを適当な名前で保存します。
{ "title": "右 command key で「英数」と「かな」をトグル", "rules": [ { "description": "右 command key で「英数」と「かな」をトグル。他のキーと同時押ししたときは通常の右 command key として働く", "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" } ] } ] } ] }
Complex_Modifications 機能の有効化
Kanabiner-Elements の Preferences を開きます。
Complex_Modifications タブをクリックし、Add rule をクリックします。
上記作業が問題なく完了していれば「右 command key で「英数」と「かな」をトグル」という項目が増えていますので、その右隣の Enable ボタンをクリックします。
以上で、
- 右 command key を押下したときは、英数/かな のトグル
- 右 command key を他のキーと同時に押下したときは、通常の右 command key の動き (command + A で全選択など)
という動きを実現できます。
以前、他のアプリケーションと組み合わせてこの動きを実現していたときは、英数かなの切り替えがモサっとしてて、ちょいちょいストレスが溜まりましたが、これで更に快適に使えそうです!