MacBook を使っていると、外部キーボードと純正キーボードの操作感の違いに悩むことがあります。
私は普段、`Nuphy Air75 v3` を使っており、カーソル移動や入力切り替えなどをファームウェア側でカスタマイズしています。
そのため、MacBook の純正キーボードを触ったときに毎回感じていたのがこれ。
- 矢印キーが遠い
- 日本語入力切り替えがしづらい
- ホームポジションから手を動かしたくない
- 外部キーボードとの操作感が違いすぎる
特に、外で MacBook 単体を使うときにかなり違和感がありました。
そこで今回は、Karabiner-Elements を使って MacBook の純正キーボードにも Fn レイヤーを作り、普段の外部キーボードと近い操作感にした話を書きます。
実現したかったこと
今回やりたかったのはこんな感じです。
| キー | 動作 |
|---|---|
| Fn + J/K/I/L | ← ↓ ↑ → |
| Fn + F + J/L | 単語単位移動 |
| Fn + D + J/L | 行頭 / 行末 |
| Fn + U | 英数 |
| Fn + O | かな |
つまり、ホームポジションからほぼ手を動かさずに操作できるようにしたかった感じです。
使用したもの
Karabiner-Elements
Mac のキーマップ変更では定番のツールです。
公式サイト:
インストール後、Complex Modifications からで JSON を追加することで自由にキーマップを変更できます。
Add your own rule
カーソル移動用 Fn レイヤー
まずはメインのカーソル移動設定です。
{
"description": "Fnレイヤーによるカーソル移動(矢印・単語・行頭行末)",
"manipulators": [
{
"from": {
"key_code": "f",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [
{
"set_variable": {
"name": "fn_f_mode",
"value": 1
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "fn_f_mode",
"value": 0
}
}
],
"type": "basic"
},
{
"from": {
"key_code": "d",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [
{
"set_variable": {
"name": "fn_d_mode",
"value": 1
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "fn_d_mode",
"value": 0
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "fn_f_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "j",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["option"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "fn_f_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["option"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "fn_d_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "j",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["command"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "fn_d_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["command"]
}
],
"type": "basic"
},
{
"from": {
"key_code": "j",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [{ "key_code": "left_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "k",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [{ "key_code": "down_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "i",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [{ "key_code": "up_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [{ "key_code": "right_arrow" }],
"type": "basic"
}
]
}
日本語入力切り替え
英数・かな切り替えもホームポジションで操作できるようにしています。
{
"description": "Fn + u = 英数, Fn + o = かな",
"manipulators": [
{
"from": {
"key_code": "u",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [{ "key_code": "japanese_eisuu" }],
"type": "basic"
},
{
"from": {
"key_code": "o",
"modifiers": {
"mandatory": ["fn"],
"optional": ["any"]
}
},
"to": [{ "key_code": "japanese_kana" }],
"type": "basic"
}
]
}
これが思った以上に快適です。
かなキーをトグル化
Mac の日本語入力って、かなキーを押しても「かな状態のまま」なんですよね!
それが少し気になったので、かな状態なら英数へ戻すようにしています。
{
"description": "かなキーをトグル方式にする(かなのときだけ英数に切り替え)",
"manipulators": [
{
"conditions": [
{
"input_sources": [{ "language": "ja" }],
"type": "input_source_if"
}
],
"from": { "key_code": "japanese_kana" },
"to": [{ "key_code": "japanese_eisuu" }],
"type": "basic"
}
]
}
abcキーをFn化
左手の親指でFnとしての役割がしやすいので、英数キー自体を Fn に変換しています。
{
"description": "abcキーをFnに変換(レイヤー用)",
"manipulators": [
{
"from": { "key_code": "japanese_eisuu" },
"to": [{ "key_code": "fn" }],
"type": "basic"
}
]
}
これによって、左親指でレイヤーを発動できるようになりました。
かなり使いやすいです。
実際に使ってみて
正直、MacBook の純正キーボードを使うことは外出時に外部キーボードを持ち運びたくない時くらいなのですが、外部キーボードと操作感を統一できるのはめちゃくちゃいいですね!
最後に
私のNuphy のファームウェアの設定はこちら
コーヒー1杯分の応援をいただけると励みになります!