何度も備忘録として見に来るけど、旧 Karabinerの設定しか書いてなくて毎回凹むので Karabiner-Elements の設定を残しておく。
json は自分で beautify して欲しい(自分には標準的な json のインデントは受け入れられない)。
主に PC 用キーボードを繋いで Windows 風に使いたい人向けの設定のつもり。
追記: ここに書いておくより gist に置いておくほうが参照しやすいかもと思ったので gist に置いた。
今後も追記しそうだけど修正するのは gist 側だけになるかも。
some PC-esque settings for Karabiner Elements · GitHub
追記2: 結局1ファイルに収まらなくなってきてファイルを分割した。
もう gist の方を見てもらうしかない。
Apple の日本語キーボードの場合だけ Control を Command 扱いと、Caps Lock を Ctrl 扱いにする。Apple の日本語キーボード以外では Caps Lock を Command 扱いにする。ProductID で JIS キーボードかどうか区別できてない気もするし、手持ちの2個だけなので自分の環境の ProductID に上手い事書き換えて下さい。
{ "title": "karabiner - around Ctrl and Command-key settings", "rules": [ { "description": "change left-Control(⌃) to left-Command(⌘) on Apple JIS keyboards", "manipulators": [ { "type": "basic", "from": { "key_code": "left_control", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "left_command" } ], "conditions": [ { "type": "device_if", "identifiers": [ { "vendor_id": 1452, "product_id": 633, "description": "Apple Internal Keyboard (MacBook (Retina, 12-inch, 2017))" }, { "vendor_id": 1452, "product_id": 656, "description": "Apple Internal Keyboard (MacBook Air (11-inch, Early 2014))" } ] } ] } ] }, { "description": "change Caps-lock(⇪) to left-Control(⌃) on Apple JIS keyboards", "manipulators": [ { "type": "basic", "from": { "key_code": "caps_lock", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "left_control" } ], "conditions": [ { "type": "device_if", "identifiers": [ { "vendor_id": 1452, "product_id": 633, "description": "Apple Internal Keyboard (MacBook (Retina, 12-inch, 2017))" }, { "vendor_id": 1452, "product_id": 656, "description": "Apple Internal Keyboard (MacBook Air (11-inch, Early 2014))" } ] } ] } ] }, { "description": "change Caps-lock(⇪) to left-Command(⌘) on non-Apple JIS keyboard", "manipulators": [ { "type": "basic", "from": { "key_code": "caps_lock", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "left_command" } ], "conditions": [ { "type": "device_unless", "identifiers": [ { "vendor_id": 1452, "product_id": 633, "description": "Apple Internal Keyboard (MacBook (Retina, 12-inch, 2017))" }, { "vendor_id": 1452, "product_id": 656, "description": "Apple Internal Keyboard (MacBook Air (11-inch, Early 2014))" } ] } ] } ] } ] }
Home と End がありえない挙動をするので、こちらの望む挙動に変更。
{ "title": "Karabiner - functional keys settings", "rules": [ { "description": "change Home(↖) to Command(⌘) + left-arrow", "manipulators": [ { "type": "basic", "from": { "key_code": "home", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "left_arrow", "modifiers": "command" } ] } ] }, { "description": "change End(↘) to Command(⌘) + right-arrow", "manipulators": [ { "type": "basic", "from": { "key_code": "end", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "right_arrow", "modifiers": "command" } ] } ] } ] }
古き良き XFER と NFER (いやこれPC-98での名前だろ、俺はPC-98から入ったから好きだが)を英数とかなに置き換えるのと、
バックスラッシュ周りで要らん事しやがるのを回避。この Apple の愚行は MS が日本語フォントのバックスラッシュを円記号のグリフにしてるのと同じ程度の愚行だと思う。
誰得なのか3秒程度考える知恵があったらこんな仕様にならないだろ。
{ "title": "Karabiner - Japanese keyboard settings", "rules": [ { "description": "change Yen-sign(\u00a5) to Backslash(\\)", "manipulators": [ { "type": "basic", "from": { "key_code": "international3" }, "to": [ { "key_code": "international3", "modifiers": "option" } ] } ] }, { "description": "change Option(⌥) + Yen-sign(\u00a5) to Yen-sign(\u00a5)", "manipulators": [ { "type": "basic", "from": { "key_code": "international3", "modifiers": { "mandatory": "option" } }, "to": [ { "key_code": "international3" } ] } ] }, { "description": "change nfer(\u7121\u5909\u63db) to eisuu(\u82f1\u6570)", "manipulators": [ { "type": "basic", "from": { "key_code": "japanese_pc_nfer", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "japanese_eisuu" } ] } ] }, { "description": "change xfer(\u5909\u63db) to kana(\u304b\u306a)", "manipulators": [ { "type": "basic", "from": { "key_code": "japanese_pc_xfer", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "japanese_kana" } ] } ] } ] }
これは完全にアプリ単位での処理
{ "title": "Karabiner - Windows-esque style settings", "rules": [ { "description": "open Developer Tools/Web Inspector with Ctrl+Shift+I in Chrome/Safari/Firefox/Vivaldi", "manipulators": [ { "type": "basic", "from": { "key_code": "i", "modifiers": { "mandatory": ["left_command", "shift"] } }, "to": [ { "key_code": "i", "modifiers": ["option", "left_command"] } ], "conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.google\\.Chrome$", "^com\\.google\\.Chrome.canary$", "^com\\.google\\.Chrome.beta$", "^com\\.google\\.Chrome.dev$", "^org\\.chromium\\.Chromium$", "^org\\.mozilla\\.firefox$", "^com\\.vivaldi\\.Vivaldi$" ] } ] } ] }, { "description": "move file to trash with Delete on finder", "manipulators": [ { "type": "basic", "from": { "key_code": "delete_forward" }, "to": [ { "key_code": "delete_or_backspace", "modifiers": ["left_command"] } ], "conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": ["^com\\.apple\\.finder$"] } ] } ] }, { "description": "delete file immediately with Shift+Delete on finder", "manipulators": [ { "type": "basic", "from": { "key_code": "delete_forward", "modifiers": { "mandatory": ["shift"] } }, "to": [ { "key_code": "delete_or_backspace", "modifiers": ["option", "left_command"] } ], "conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": ["^com\\.apple\\.finder$"] } ] } ] } ] }
これは適用しなくていいです。UK キーボード(US じゃない UK だ)で日本語どうやって入力すんだよ!と思って調べた知識の確認なので。
もしこっちを使いたかったら上の英数とかなへの変換の方を適用しないでおく。
{ "title": "Karabiner - additional settings for compatibility", "rules": [ { "description": "change nfer(\u7121\u5909\u63db) to Option(⌥) + Shift(⇧) + S", "manipulators": [ { "type": "basic", "from": { "key_code": "japanese_pc_nfer", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "s", "modifiers": ["option", "left_shift"] } ] } ] }, { "description": "change xfer(\u5909\u63db) to Option(⌥) + Shift(⇧) + Z", "manipulators": [ { "type": "basic", "from": { "key_code": "japanese_pc_xfer", "modifiers": {"optional": "any"} }, "to": [ { "key_code": "z", "modifiers": ["option", "left_shift"] } ] } ] } ] }