Skip to content

Instantly share code, notes, and snippets.

@mh-mobile
Last active December 8, 2023 11:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mh-mobile/e792d6a1d96a11a0fc587449c2d4c2d6 to your computer and use it in GitHub Desktop.
Save mh-mobile/e792d6a1d96a11a0fc587449c2d4c2d6 to your computer and use it in GitHub Desktop.
DiscordのEnterキーの挙動変更(Karabiner-Elements)- Enterで改行 / Command + Enterで送信
{
"title": "Discord-Enter-Modification",
"rules": [
{
"description": "Discord-Enter-Modification",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "return_or_enter"
},
"to": [
{
"key_code": "return_or_enter",
"modifiers": ["left_shift"]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": ["^com\\.hnc\\.Discord"]
}
]
},
{
"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\\.hnc\\.Discord"]
}
]
}
]
}
]
}
@mh-mobile
Copy link
Author

mh-mobile commented Dec 13, 2021

前提条件

Karabiner-Elementsをインストールします。

https://karabiner-elements.pqrs.org/

※ macOS Monterey 12.0.1 で Karabiner-Elements v14.3.0で動作確認済み

設定のインストール

  1. JSONの設定ファイルを ~/.config/karabiner/assets/complex_modifications 配下にダウンロードする
$ curl -o ~/.config/karabiner/assets/complex_modifications/discord-enter-modification.json https://gist.githubusercontent.com/mh-mobile/e792d6a1d96a11a0fc587449c2d4c2d6/raw/ae56333a1940e83b7ea6d6d3d79324d64aaaeb0e/discord-enter-modification.json
  1. Karabiner-Elementsの設定画面でComplex modificationsタブを開き、Add ruleを選択する。
    CleanShot 2021-12-13 at 20 32 52

  2. Discord-Enter-Modification の Enableボタンを選択し、設定を有効化する。
    CleanShot 2021-12-13 at 20 35 17

  3. Complex Modificationsタブで Discord-Enter-Modificationの設定が追加されたことを確認します。

CleanShot 2021-12-13 at 20 48 13

使い方

  1. Discord アプリを起動します。

Discordアプリが前面で起動している場合のみ次のキーバインドが有効になります。

  1. 入力フォームで キーバインドが次のように動作します。
  • Enterボタンを押下 → テキストを改行 (従来のLeft Shift + Enterの挙動)
  • Command + Enterボタンを押下 → テキストを送信 (従来のEnterの挙動)

補足

DiscordのBundle IDの値は、com.hnc.Discord になります。
参考: macOS Bundle ID List

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment