MacOS版 Microsoft Remote Desktop の JIS → USキーボード問題を Karabiner-Elements で解決

【2020/5/16 追記】
Microsoft Remote Desktop Ver.10.3.10 で、下記のキーボード問題は解消されたようです


久々に在宅ワークになったら、MacからRDPの記号がマトモに入らなくなっていたので、結局 Karabiner-Elements(JIS → US変換)で対策に至ったメモ

コレ、前からダメだったっけ?と思いながら検索すると、ストアにある Parallels RDP Client で接続するのが定番らしく、早速インストールして、しばらく使ってみたが ctrl + tab が効かない等、個人的に許せない箇所がポツポツと...
で、純正の Microsoft Remote Desktop (記述時点で ver. 10.3.9)で何とかしようとした話

まず、Keyborad Mode を Scancode から Unicode へ切り替えると、なんと記号がマトモに入るように!!

喜びもつかの間、日本語入力に切り替えた途端、文字がずれて全く使い物になりません(w

結局、 Karabiner-Elements と Karabiner-EventViwer でコツコツとキーを探して jsonを作成

下記の json は、よくある「かな漢字切り替え」のキーを Shift + F1 で切り替えるようにWindows側で設定しておいて、Macの「かな」キーを Shift + F1 へ変換するようにしています (↓Google 日本語入力の場合、各状態に Shift + F1 などを追加)
 
ので、別のキーへアサインしている方は、変更してください(一番最初の定義です)

また、一番最後の定義で shift +「ろ」(international1)でバックスラッシュを定義していますので、不要な方は消したりしてください。それ以外は、キーボードの記載通りのハズです


jis2us.json
{
  "title": "JIS配列 → US配列変換(RDP)",
  "rules": [
    {
      "description": "かなキーIMEトグル(RDP)",
      "manipulators": [
        {
          "type": "basic",
          "description": "かなキーを Shift + F1 へ変換(RDP)",
          "from": {
            "key_code": "japanese_kana"
          },
          "to": [
            {
              "key_code": "f1",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        }
      ]
    },
 
    {
      "description": "JIS配列 → US配列変換(RDP)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "2",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "quote",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "6",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "7",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "7",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "quote",
              "modifiers": [ ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "8",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "9",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "9",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "0",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "0",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "vk_none",
              "modifiers": [ ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "hyphen",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "equal_sign",
              "modifiers": [ ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "equal_sign",
            "modifiers": { "mandatory": [ ] }
          },
          "to": [
            {
              "key_code": "6",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "equal_sign",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "open_bracket",
            "modifiers": { "mandatory": [ ] }
          },
          "to": [
            {
              "key_code": "2",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },
        
        {
          "type": "basic",
          "from": {
            "key_code": "close_bracket",
            "modifiers": { "mandatory": [ ] }
          },
          "to": [
            {
              "key_code": "open_bracket",
              "modifiers": [  ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "backslash",
            "modifiers": { "mandatory": [ ] }
          },
          "to": [
            {
              "key_code": "close_bracket",
              "modifiers": [  ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "quote",
            "modifiers": { "mandatory": [ ] }
          },
          "to": [
            {
              "key_code": "semicolon",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "semicolon",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "equal_sign",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "quote",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "8",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "open_bracket",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [ ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "close_bracket",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "open_bracket",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "backslash",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "close_bracket",
              "modifiers": [ "shift" ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        },

        {
          "type": "basic",
          "from": {
            "key_code": "international1",
            "modifiers": { "mandatory": [ "shift" ] }
          },
          "to": [
            {
              "key_code": "backslash",
              "modifiers": [ ]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.microsoft\\.rdc\\."
              ]
            }
          ]
        }

      ]
    }
 ]
}


かなトグルの説明と画像が兼用なのをご了承ください
既に Karabiner-Elements を設定して利用している場合、Profilesから新しいプロファイルを作成してお試しください
  1. Karabiner-Elements のデータフォルダを開いて
  2. assets/complex_modifications に 上記の jis2us.json (UTF-8 であればファイル名は何でもよい)を作成またはコピペ
  3. Add rule を開いて
  4. JIS配列 → US配列変換(RDP) を Enable All で取り込む
    jsonが正しくない場合ココに表示されません
  5. 取り込まれて利用可能になるハズ

    ※jsonファイルを変更した時は、ここで Removeの後、再度取り込む必要があります

コメント