Karabinerの設定ファイルメモ
Karabinerで設定ファイルを作ったのでメモ
やったこと
こんな感じの設定を作った。ctrl + m で return に、 ctrl + [ で esc に割り当てるだけの単純なキー割り当て。

つまづいたこと
JISキーボードとUSキーボードで、 key_code の内容が違う。
JISキーボードで [ キーに割当てを行いたい場合は、 key_code は close_bracket じゃないといけない。
Karabiner-ElementsでのJIS・USのキーコード対応表 - Qiita
手順
~/.config/karabiner/assets/complex_modifications/内に好きな名前のJSONファイルを作る上述のJSONファイルに設定を書く
今回の例
1{
2 "title": "自分用",
3 "rules": [
4 {
5 "description": "ctrl-M を return に変換",
6 "manipulators": [
7 {
8 "type": "basic",
9 "from": {
10 "key_code": "m",
11 "modifiers": {
12 "mandatory": [
13 "control"
14 ]
15 }
16 },
17 "to": [
18 {
19 "key_code": "return_or_enter"
20 }
21 ]
22 }
23 ]
24 },
25 {
26 "description": "ctrl-[ を escに変換",
27 "manipulators": [
28 {
29 "type": "basic",
30 "from": {
31 "key_code": "close_bracket",
32 "modifiers": {
33 "mandatory": [
34 "control"
35 ]
36 }
37 },
38 "to": [
39 {
40 "key_code": "escape"
41 }
42 ]
43 }
44 ]
45 }
46 ]
47}
- Karabinerの設定画面の「Complex modifications」タブの左下にある「Add rule」ボタンを押すと、JSONファイルの設定内容を選べるようになるので、対応する「Enable」ボタンをクリックする。
参考
以下のページのほうがより親切に記載されている。
Categories: