Skip to content

Instantly share code, notes, and snippets.

@azu
Last active August 2, 2025 05:17
Show Gist options
  • Save azu/10268f35f5c7c286e72398d2e3262796 to your computer and use it in GitHub Desktop.
Save azu/10268f35f5c7c286e72398d2e3262796 to your computer and use it in GitHub Desktop.
Claude Desktop IME Fix for Karabiner-Elements - 日本語IME変換時の誤送信を防ぐ設定

Claude Desktop IME Fix for Karabiner-Elements

Claude DesktopのOption+Space(クイックエントリー)を使用する際、日本語IMEの変換確定のEnterキーで誤ってメッセージが送信されてしまう問題を解決するKarabiner-Elementsの設定です。

Karabiner-Elements設定

{
  "title": "Claude Desktop IME Fix for Japanese Input",
  "rules": [
    {
      "description": "Claude Desktop: Solo Enter → Shift+Enter (改行), Cmd+Enter → Enter (送信)",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [],
          "from": {
            "key_code": "spacebar",
            "modifiers": {
              "mandatory": ["option"]
            }
          },
          "to": [
            {
              "shell_command": "open -g -b com.anthropic.claudefordesktop"
            },
            {
              "key_code": "spacebar",
              "modifiers": ["option"]
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "return_or_enter",
            "modifiers": {
              "mandatory": ["command"]
            }
          },
          "to": [
            {
              "key_code": "return_or_enter"
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.anthropic\\.claudefordesktop$"
              ]
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "return_or_enter"
          },
          "to": [
            {
              "key_code": "return_or_enter",
              "modifiers": ["shift"]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.anthropic\\.claudefordesktop$"
              ]
            }
          ]
        }
      ]
    }
  ]
}

問題

Claude DesktopのクイックエントリーウィンドウをOption+Spaceで起動して使用する際、日本語IMEで変換を確定するためのEnterキーが、そのままメッセージ送信として扱われてしまいます。

解決策

この設定により、Claude Desktop内でのキーマッピングを以下のように変更します:

  • Enter単独Shift+Enter(改行のみ)
  • Cmd+EnterEnter(メッセージ送信)

インストール方法

  1. 上記のKarabiner-Elements設定をコピー
  2. Karabiner-Elementsを開く
  3. "Complex Modifications"タブを選択
  4. "Add rule"ボタンをクリック
  5. "Add your own rule"ボタンをクリック
  6. 表示されたダイアログにJSONをペースト
  7. "Save"ボタンをクリック

使い方

設定を有効にすると、Claude Desktop内で:

  • 日本語入力の変換確定は通常通りEnterキーで行えます
  • メッセージを送信するにはCmd+Enterを使用します
  • 改行のみを入力したい場合は、そのままEnterキーを押します(Shift+Enterとして扱われます)

技術詳細

  • Option+Spaceを押すと、まずopen -g -bでClaude Desktopをバックグラウンドで起動/フォーカス
  • その後、本来のOption+Spaceをパススルーしてクイックエントリーを開く
  • bundle_identifiersに正規表現パターン^com\\.anthropic\\.claudefordesktop$を使用
  • 3つのmanipulatorsで構成:
    1. Option+SpaceでClaude Desktopにフォーカスを当ててからクイックエントリーを開く
    2. Cmd+Enterを通常のEnterに変換(送信用)
    3. 単独のEnterをShift+Enterに変換(改行用)

互換性

  • Karabiner-Elements 12.3.0以降
  • Claude Desktop for macOS
  • macOS 11.0以降

ライセンス

Public Domain

{
"title": "Claude Desktop IME Fix for Japanese Input",
"rules": [
{
"description": "Claude Desktop: Solo Enter → Shift+Enter (改行), Cmd+Enter → Enter (送信)",
"manipulators": [
{
"type": "basic",
"conditions": [],
"from": {
"key_code": "spacebar",
"modifiers": {
"mandatory": ["option"]
}
},
"to": [
{
"shell_command": "open -g -b com.anthropic.claudefordesktop"
},
{
"key_code": "spacebar",
"modifiers": ["option"]
}
]
},
{
"type": "basic",
"from": {
"key_code": "return_or_enter",
"modifiers": {
"mandatory": ["command"]
}
},
"to": [
{
"key_code": "return_or_enter"
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.anthropic\\.claudefordesktop$"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "return_or_enter"
},
"to": [
{
"key_code": "return_or_enter",
"modifiers": ["shift"]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.anthropic\\.claudefordesktop$"
]
}
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment