ホーム 暮らし [Mac] Karabiner-Elements for keyboard expansion

[Mac] Karabiner-Elements for keyboard expansion

藤崎 健人 藤崎 健人 • 更新: • 公開: • 読了約 25 分
目次


Expanding your keyboard

nce42581d4952

When you strike a key, if you observe closely, two events occur.

  1. Key is pressed

  2. Key is released

Furthermore, there are multiple keys that can be replaced by just one of these actions.

In other words, the following is possible.

: Can be assigned to a single press

For example, regarding the Command key

: Can be assigned to a long press

For example, regarding the Caps Lock key



What is Karabiner-Elements?

Karabiner-Elements is a keyboard customization tool for macOS.

You already know, right?

By using this app, you can without polluting existing keyboard operations add a large number of shortcuts.



Shortcut ideas

I will introduce the configuration method later. You can use them by copy-pasting.

⌘ for Eisu/Kana
 "description": "⌘ -> 英数/かな",
 "manipulators": [
 
 "from": "key_code": "left_command" ,
 "to": "key_code": "left_command" ,
 "to_if_alone": [ "key_code": "japanese_eisuu" ],
 "type": "basic"
 ,
 
 "from": "key_code": "right_command" ,
 "to": "key_code": "right_command" ,
 "to_if_alone": [ "key_code": "japanese_kana" ],
 "type": "basic"
 

 ]
Make ⇪ a Hyper key
 "description": "⇪ --> Hyper",
 "manipulators": [
 
 "from": "key_code": "caps_lock" ,
 "to": [
 
 "key_code": "right_command",
 "lazy": true,
 "modifiers": ["right_control", "right_option", "right_shift"]
 
 ],
 "to_if_alone": [ "key_code": "caps_lock" ],
 "type": "basic"
 
 ]
Force quit by long-pressing the Esc key
 "description": "␛ --> ⌥⌘␛",
 "manipulators": [
 
 "from": 
 "key_code": "escape",
 "modifiers": "optional": ["any"] 
 ,
 "parameters": 
 "basic.to_if_alone_timeout_milliseconds": 250,
 "basic.to_if_held_down_threshold_milliseconds": 250
 ,
 "to_if_alone": [ "key_code": "escape" ],
 "to_if_held_down": [
 
 "key_code": "escape",
 "lazy": true,
 "modifiers": ["left_option", "left_command"]
 
 ],
 "type": "basic"
 
 ]
Screenshot by double-tapping R⌘
 "description": "R⌘ x2 --> ^⇧⌘4",
 "manipulators": [
 
 "conditions": [
 
 "name": "r_cmd_tapped",
 "type": "variable_if",
 "value": 1
 
 ],
 "from": "key_code": "right_command" ,
 "parameters": "basic.to_if_alone_timeout_milliseconds": 150 ,
 "to": [
 "key_code": "right_command" ,
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 0
 
 
 ],
 "to_if_alone": [
 
 "key_code": "4",
 "modifiers": ["left_control", "left_command", "left_shift"]
 ,
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 0
 
 
 ],
 "type": "basic"
 ,
 
 "from": "key_code": "right_command" ,
 "parameters": 
 "basic.to_delayed_action_delay_milliseconds": 200,
 "basic.to_if_alone_timeout_milliseconds": 150
 ,
 "to": [ "key_code": "right_command" ],
 "to_delayed_action": 
 "to_if_canceled": [
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 0
 
 
 ],
 "to_if_invoked": [
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 0
 
 
 ]
 ,
 "to_if_alone": [
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 1
 
 
 ],
 "type": "basic"
 
 ]



Configuration method

1. Select Complex Modifications from the sidebar

2. Click Add your own rule at the top of the screen.

3. Delete the example and paste the rule.

4. Press Save to save.



Introducing frequently used triggers

This app allows for detailed customization such as "when a key is released," "long press," "double tap," and "conditional branching." Here are a few examples.

When a key is pressed
to: []
When a key is pressed and released on its own
to_if_alone: []
When a key is long-pressed
to_if_held_down: []



Shortcuts I personally find useful

L⌘ for screenshot
 "description": "L⌘ -> ⇧⌘5",
 "manipulators": [
 
 "from": "key_code": "left_command" ,
 "parameters": "basic.to_if_alone_timeout_milliseconds": 200 ,
 "to": [ "key_code": "left_command" ],
 "to_if_alone": [
 
 "key_code": "5",
 "modifiers": ["left_command", "left_shift"]
 
 ],
 "type": "basic"
 
 ]
R⌘ double tap for screenshot
 "description": "R⌘ x2 --> ^⇧⌘4",
 "enabled": false,
 "manipulators": [
 
 "conditions": [
 
 "name": "r_cmd_tapped",
 "type": "variable_if",
 "value": 1
 
 ],
 "from": "key_code": "right_command" ,
 "parameters": "basic.to_if_alone_timeout_milliseconds": 150 ,
 "to": [
 "key_code": "right_command" ,
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 0
 
 
 ],
 "to_if_alone": [
 
 "key_code": "4",
 "modifiers": ["left_control", "left_command", "left_shift"]
 ,
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 0
 
 
 ],
 "type": "basic"
 ,
 
 "from": "key_code": "right_command" ,
 "parameters": 
 "basic.to_delayed_action_delay_milliseconds": 200,
 "basic.to_if_alone_timeout_milliseconds": 150
 ,
 "to": [ "key_code": "right_command" ],
 "to_delayed_action": 
 "to_if_canceled": [
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 0
 
 
 ],
 "to_if_invoked": [
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 0
 
 
 ]
 ,
 "to_if_alone": [
 
 "set_variable": 
 "name": "r_cmd_tapped",
 "value": 1
 
 
 ],
 "type": "basic"
 
 ]
Eisu to Hyper key
 "description": "英数 -> L✦",
 "manipulators": [
 
 "from": "key_code": "japanese_eisuu" ,
 "to": [
 
 "key_code": "left_command",
 "lazy": true,
 "modifiers": ["left_control", "left_option", "left_shift"]
 
 ],
 "to_if_alone": [ "key_code": "japanese_eisuu" ],
 "type": "basic"
 
 ]
Kana to Hyper key
 "description": "かな --> R✦",
 "manipulators": [
 
 "from": "key_code": "japanese_kana" ,
 "to": [
 
 "key_code": "right_command",
 "lazy": true,
 "modifiers": ["right_control", "right_option", "right_shift"]
 
 ],
 "to_if_alone": [ "key_code": "japanese_kana" ],
 "type": "basic"
 
 ]
Burn →←↑↓ into ^FBPN
 "description": "^fbpn --> →←↑↓",
 "manipulators": [
 
 "from": 
 "key_code": "f",
 "modifiers": 
 "mandatory": ["control"],
 "optional": ["shift"]
 
 ,
 "to": [ "key_code": "right_arrow" ],
 "type": "basic"
 ,
 
 "from": 
 "key_code": "b",
 "modifiers": 
 "mandatory": ["control"],
 "optional": ["shift"]
 
 ,
 "to": [ "key_code": "left_arrow" ],
 "type": "basic"
 ,
 
 "from": 
 "key_code": "p",
 "modifiers": 
 "mandatory": ["control"],
 "optional": ["shift"]
 
 ,
 "to": [ "key_code": "up_arrow" ],
 "type": "basic"
 ,
 
 "from": 
 "key_code": "n",
 "modifiers": 
 "mandatory": ["control"],
 "optional": ["shift"]
 
 ,
 "to": [ "key_code": "down_arrow" ],
 "type": "basic"
 
 ]
Burn ⌫⌦ into ^HD (disabled in Terminal)
 "description": "^hd --> ⌫⌦",
 "manipulators": [
 
 "from": 
 "key_code": "h",
 "modifiers": "mandatory": ["control"] 
 ,
 "to": [ "key_code": "delete_or_backspace" ],
 "type": "basic"
 ,
 
 "conditions": [
 
 "bundle_identifiers": [
 "^com\\.apple\\.Terminal$",
 "^com\\.mitchellh\\.ghostty$"
 ],
 "type": "frontmost_application_unless"
 
 ],
 "from": 
 "key_code": "d",
 "modifiers": "mandatory": ["control"] 
 ,
 "to": [ "key_code": "delete_forward" ],
 "type": "basic"
 
 ]
Merge ⇪ and fn
 "description": "⇪ --> fn",
 "manipulators": [
 
 "from": 
 "key_code": "caps_lock",
 "modifiers": "optional": ["any"] 
 ,
 "to": [ "key_code": "fn" ],
 "to_if_alone": [
 
 "hold_down_milliseconds": 100,
 "key_code": "caps_lock"
 
 ],
 "type": "basic"
 
 ]





同じカテゴリの記事

藤崎 健人

芸能取材歴10年のデスク。所属事務所の公式リリース、番組公式サイト、配信サービスの告知を一次情報として採用し、裏付けの取れない内容は記事にしていません。

おすすめの関連記事