Karabiner-Elements を使って iTerm2 と RDP 以外では ctrl を cmd にする (Mistel BAROCCO MD770)
MacBook に Mistel BAROCCO MD770 をつないで iTerm2 使いながらリモートデスクトップもするためのメモ。なお Ctrl と CapsLock は MD770 側で切替済み。
やったこと:
- ctrl を cmd に
- ただし iTerm と RDP 中は左 ctrl をctrl のままに
- 右 ctrl は cmd のままにすることでコピー&ペーストできるように
- 日本語変換は CapsLock でトグル
手順: Karabiner-Elements
- caps_lock を英数キーに
- Complex modifications で:
- 英数・カナキーを toggle 方式にする
- 下記設定を追加
"description": "iTerm2 と RDP 以外では ctrl を cmd にする", "manipulators": [ { "type": "basic", "from": { "key_code": "left_control", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "left_command", "lazy": true } ], "conditions": [ { "type": "frontmost_application_unless", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$", "com\\.microsoft\\.rdc\\.macos" ] } ] }, { "type": "basic", "from": { "key_code": "right_control", "modifiers": { "optional": [ "any" ] } }, "to": [ { "key_code": "right_command", "lazy": true } ], "conditions": [ { "type": "frontmost_application_unless", "bundle_identifiers": [ "com\\.microsoft\\.rdc\\.macos" ] } ] } ] },
これは
karabiner-elements-complex_modifications
の Map left ctrl to command, command to option, option to control unless in iTerm2 or Remote Desktop
を参考にしたもの。右 ctrl の条件だけ変えてある。
本当は左右 cmd で日本語変換を切り替えたかったのだけれどそれだと iTerm 中に変換ができなくなってしまうため CapsLock に割り当てた。これでそれぞれの環境でそれなりのキーマッピングになった。