Karabiner-Elements/MySettings

# はじめに
今回、たまたまOSをクリーンインストールしたこともあって、
そういうときに忘れがちなのが、Karabiner-Elementsの設定だったので、
今回、自分の設定を書き残しておくことにします。

# 前提条件
- 2022/10/23現在
- MacBook Pro (13-inch, M1, 2020)
- Apple M1
- macOS Monterey(12.6)
 - 工場出荷状態
- ThinkPad トラックポイント キーボード II - 日本語
- Karabiner-Elements version 14.10.0

# 設定
## Karabiner-Elements編
Karabiner-ElementsのSetting画面の `Simple Modifications` で、対象のキーボード設定を選択
自分は `ThinkPad Compact Bluetooth Keyboard with TrackPoint` って名前と `TrackPoint Keyboard Ⅱ` だった（キーボードを買い替えたりしたので)

選択したら、下図の通り設定する。アイテムの追加は、 `Add item` をクリックして追加していく

![karabiner-elements.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/105220/a1aa7dc2-2e19-01ff-eeaf-9c45f8f566cc.png)


## ファイル編
色々書こうと思いましたが、設定ファイル(~/.config/karabiner/karabiner.json)をそのまま残します。
基本的にこれが今しっくり来ているので、設定ファイルをそのまま残します。

```json
{
    "global": {
        "check_for_updates_on_startup": true,
        "show_in_menu_bar": true,
        "show_profile_name_in_menu_bar": false,
        "unsafe_ui": false
    },
    "profiles": [
        {
            "complex_modifications": {
                "parameters": {
                    "basic.simultaneous_threshold_milliseconds": 50,
                    "basic.to_delayed_action_delay_milliseconds": 500,
                    "basic.to_if_alone_timeout_milliseconds": 1000,
                    "basic.to_if_held_down_threshold_milliseconds": 500,
                    "mouse_motion_to_scroll.speed": 100
                },
                "rules": []
            },
            "devices": [
                {
                    "disable_built_in_keyboard_if_exists": false,
                    "fn_function_keys": [],
                    "identifiers": {
                        "is_keyboard": true,
                        "is_pointing_device": false,
                        "product_id": 16641,
                        "vendor_id": 1578
                    },
                    "ignore": true,
                    "manipulate_caps_lock_led": false,
                    "simple_modifications": [],
                    "treat_as_built_in_keyboard": false
                },
                {
                    "disable_built_in_keyboard_if_exists": false,
                    "fn_function_keys": [],
                    "identifiers": {
                        "is_keyboard": false,
                        "is_pointing_device": true,
                        "product_id": 16641,
                        "vendor_id": 1578
                    },
                    "ignore": true,
                    "manipulate_caps_lock_led": false,
                    "simple_modifications": [],
                    "treat_as_built_in_keyboard": false
                },
                {
                    "disable_built_in_keyboard_if_exists": false,
                    "fn_function_keys": [],
                    "identifiers": {
                        "is_keyboard": true,
                        "is_pointing_device": false,
                        "product_id": 833,
                        "vendor_id": 1452
                    },
                    "ignore": false,
                    "manipulate_caps_lock_led": true,
                    "simple_modifications": [],
                    "treat_as_built_in_keyboard": false
                },
                {
                    "disable_built_in_keyboard_if_exists": false,
                    "fn_function_keys": [],
                    "identifiers": {
                        "is_keyboard": false,
                        "is_pointing_device": true,
                        "product_id": 833,
                        "vendor_id": 1452
                    },
                    "ignore": true,
                    "manipulate_caps_lock_led": false,
                    "simple_modifications": [],
                    "treat_as_built_in_keyboard": false
                },
                {
                    "disable_built_in_keyboard_if_exists": false,
                    "fn_function_keys": [],
                    "identifiers": {
                        "is_keyboard": true,
                        "is_pointing_device": false,
                        "product_id": 34304,
                        "vendor_id": 1452
                    },
                    "ignore": false,
                    "manipulate_caps_lock_led": true,
                    "simple_modifications": [],
                    "treat_as_built_in_keyboard": false
                },
                {
                    "disable_built_in_keyboard_if_exists": false,
                    "fn_function_keys": [],
                    "identifiers": {
                        "is_keyboard": true,
                        "is_pointing_device": true,
                        "product_id": 24648,
                        "vendor_id": 6127
                    },
                    "ignore": false,
                    "manipulate_caps_lock_led": true,
                    "simple_modifications": [
                        {
                            "from": {
                                "key_code": "caps_lock"
                            },
                            "to": [
                                {
                                    "key_code": "left_control"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "grave_accent_and_tilde"
                            },
                            "to": [
                                {
                                    "key_code": "f13"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "international2"
                            },
                            "to": [
                                {
                                    "key_code": "lang1"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "international4"
                            },
                            "to": [
                                {
                                    "key_code": "lang1"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "international5"
                            },
                            "to": [
                                {
                                    "key_code": "lang2"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "japanese_pc_katakana"
                            },
                            "to": [
                                {
                                    "key_code": "japanese_kana"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "japanese_pc_nfer"
                            },
                            "to": [
                                {
                                    "key_code": "japanese_eisuu"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "japanese_pc_xfer"
                            },
                            "to": [
                                {
                                    "key_code": "japanese_kana"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "left_alt"
                            },
                            "to": [
                                {
                                    "key_code": "lang2"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "left_control"
                            },
                            "to": [
                                {
                                    "key_code": "left_option"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "right_alt"
                            },
                            "to": [
                                {
                                    "key_code": "right_command"
                                }
                            ]
                        },
                        {
                            "from": {
                                "key_code": "right_control"
                            },
                            "to": [
                                {
                                    "key_code": "left_option"
                                }
                            ]
                        }
                    ],
                    "treat_as_built_in_keyboard": false
                }
            ],
            "fn_function_keys": [
                {
                    "from": {
                        "key_code": "f1"
                    },
                    "to": [
                        {
                            "consumer_key_code": "display_brightness_decrement"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f2"
                    },
                    "to": [
                        {
                            "consumer_key_code": "display_brightness_increment"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f3"
                    },
                    "to": [
                        {
                            "apple_vendor_keyboard_key_code": "mission_control"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f4"
                    },
                    "to": [
                        {
                            "apple_vendor_keyboard_key_code": "spotlight"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f5"
                    },
                    "to": [
                        {
                            "consumer_key_code": "dictation"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f6"
                    },
                    "to": [
                        {
                            "key_code": "f6"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f7"
                    },
                    "to": [
                        {
                            "consumer_key_code": "rewind"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f8"
                    },
                    "to": [
                        {
                            "consumer_key_code": "play_or_pause"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f9"
                    },
                    "to": [
                        {
                            "consumer_key_code": "fast_forward"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f10"
                    },
                    "to": [
                        {
                            "consumer_key_code": "mute"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f11"
                    },
                    "to": [
                        {
                            "consumer_key_code": "volume_decrement"
                        }
                    ]
                },
                {
                    "from": {
                        "key_code": "f12"
                    },
                    "to": [
                        {
                            "consumer_key_code": "volume_increment"
                        }
                    ]
                }
            ],
            "name": "Default profile",
            "parameters": {
                "delay_milliseconds_before_open_device": 1000
            },
            "selected": true,
            "simple_modifications": [],
            "virtual_hid_keyboard": {
                "country_code": 0,
                "indicate_sticky_modifier_keys_state": true,
                "mouse_key_xy_scale": 100
            }
        }
    ]
}
```

# さいごに
設定系って色々大変なので、またこんな感じで残していこうかなと。