macOS용 키입력 커스터마이저인 Karabiner-Elements 세팅 백업.

Karabiner-Elements: macOS 키입력 전처리 유틸리티

macOS에 가상 키보드를 설치하고, 사용자 입력을 변환한 후 OS로 보내주는 유틸리티
Karabiner-Elements is a powerful and stable keyboard customizer for macOS.

홈페이지: Karabiner-Elements

설치

brew install karabiner-elements

사용자들이 만든 프리셋 검색

https://ke-complex-modifications.pqrs.org/?q=korea

여기서 검색 후 import 해서 enable 하면 작동함.

내 개인 설정

내가 설정해놓은 Karabiner-Elements 세팅 백업.

  • 개발에 자주 쓰이는 F1~F12 키를 fn 없이 사용 (System Settings)
  • 우측 option키: F1~F12와 함께 눌렸을 때 fn처럼 작동
    • 볼륨 컨트롤시 좌측 🌐 fn + F12 는 두 손을 써야 해서 불편함.
  • 그 외, Windows도 함께 쓰는 상황에서 일상 불편함 해결.

먼저 System Settings 에서

  • Function Keys: Use F1, F2, etc. keys as standard function keys ON
  • Keyboard: Press 🌐 key to: Do Nothing
    • 이모지 검색은 RayCast로 해결 중.

Karabiner-Elements: Complex Modification

Karabiner-Elements 아이콘 클릭 > Settings 진입, 좌측 Complex Modification 선택.

Right Option + F1~12 → 미디어키/특수키

우측 Option + F1~F12키를 기본 미디어키/특수키로 작동하도록 함.

{
    "description": "Right Option + F1~F12",
    "manipulators": [
        {
            "from": {
                "key_code": "f1",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "display_brightness_decrement" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f2",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "display_brightness_increment" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f3",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "apple_vendor_keyboard_key_code": "mission_control" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f4",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "apple_vendor_keyboard_key_code": "spotlight" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f5",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "dictation" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f7",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "rewind" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f8",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "play_or_pause" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f9",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "fast_forward" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f10",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "mute" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f11",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "volume_decrement" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f11",
                "modifiers": { "mandatory": ["right_option", "right_command"] }
            },
            "to": [
                {
                    "consumer_key_code": "volume_decrement",
                    "modifiers": ["right_option", "right_shift"]
                }
            ],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f12",
                "modifiers": { "mandatory": ["right_option"] }
            },
            "to": [{ "consumer_key_code": "volume_increment" }],
            "type": "basic"
        },
        {
            "from": {
                "key_code": "f12",
                "modifiers": { "mandatory": ["right_option", "right_command"] }
            },
            "to": [
                {
                    "consumer_key_code": "volume_increment",
                    "modifiers": ["right_option", "right_shift"]
                }
            ],
            "type": "basic"
        }
    ]
}

FN + Tab → Mission Control

🌐 fn + Tab 눌러 미션 컨트롤 진입

{
    "manipulators": [
        {
            "description": "FN+Tab to MissionControl",
            "from": {
                "key_code": "tab",
                "modifiers": { "mandatory": ["fn"] }
            },
            "to": [{ "key_code": "mission_control" }],
            "type": "basic"
        }
    ]
}

FN+Command+Tab → Application Windows

🌐 fn + Command + Tab 눌러 앱 윈도 전환

기본 단축키인 Ctrl+Down 도 동일한 기능을 함.

왼손+마우스 앱 전환할 때 사용하는 용도.

{
    "manipulators": [
        {
            "description": "FN+Command+Tab to Application Windows",
            "from": {
                "key_code": "tab",
                "modifiers": { "mandatory": ["fn", "command"] }
            },
            "to": [
                {
                    "key_code": "down_arrow",
                    "modifiers": ["control"]
                }
            ],
            "type": "basic"
        }
    ]
}

우측 Command키 단독으로 release 될 때 → 한영 전환

가끔 잘 안될 경우 있음.

우측 CMD 키를 한영 전환 키로 변경하기 위해 먼저 입력언어 전환 단축키를 새로 등록.

System Settings > Keyboard > Keyboard Shortcuts > Input Sources

    Select the previous input source`: Shift + Ctrl + Option + Command + SPACE
{
    "description": "R_CMD to switch input languages on release if alone",
    "manipulators": [
        {
            "from": {
                "key_code": "right_command",
                "modifiers": { "optional": ["any"] }
            },
            "to": [{ "key_code": "right_command" }],
            "to_if_alone": [
                {
                    "key_code": "spacebar",
                    "modifiers": ["left_shift", "left_control", "left_alt", "left_command"]
                }
            ],
            "type": "basic"
        }
    ]
}

한국어 입력시 대신 `(Tilde/Backtick)를 기본으로 입력

코드 출처

` 문자 입력 안되면 마크다운 작업시 너무 불편함.
기본으로 ` 문자가 입력되고, option + ` 입력시 문자가 입력됨.

아래 코드에 2개 rule이 있으므로 전체를 Karabiner-Elements에 copy-paste 할 수 없음

rules 하나씩 개별로 복사해 넣거나, 위 코드 출처 클릭해서 import 하면 됨.

{
  "title": "Swap Won (₩) and backtick (`) in Korean layout.",
  "rules": [
    {
      "description": "Change Won (₩) to backtick (`).",
      "manipulators": [
        {
          "conditions": [
            {
              "type": "input_source_if",
              "input_sources": [
                {
                  "language": "ko"
                }
              ]
            }
          ],
          "type": "basic",
          "from": {
            "key_code": "grave_accent_and_tilde"
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option",
                "right_option"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "Change backtick (`) to Won (₩).",
      "manipulators": [
        {
          "conditions": [
            {
              "type": "input_source_if",
              "input_sources": [
                {
                  "language": "ko"
                }
              ]
            }
          ],
          "type": "basic",
          "from": {
            "key_code": "grave_accent_and_tilde",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to_if_alone": [
            {
              "key_code": "grave_accent_and_tilde"
            }
          ]
        }
      ]
    }
  ]
}