LoginSignup
18
17

More than 5 years have passed since last update.

Karabiner-Elements で左右の Cmd 単押しに英数とかなを割り当てる

Last updated at Posted at 2017-01-17

本家で complex_modifications が設定できるようになったため fork を使わなくても良くなりました

to_if_alone 設定例

complex_modifications はかなり細かく設定ができるようで,下記のリポジトリでより複雑な設定例を見ることが出来ます.
pqrs-org/KE-complex_modifications

また,下記のページから設定例をインポートできるようです.
https://pqrs.org/osx/karabiner/complex_modifications/


僕は IME をトグルで切り替えると今どっちの入力にいるのか分からなくなって嫌なので Mac でも Linux でも Windows でも英数入力への切り替えと日本語入力への切り替えを別のキーに割り当てています.
Karabiner-Elements 本家ではまだ Cmd などの modifier の単押しはできなくて,仕方なく Mac 上では Cmd+Enter でトグルしていたのですが,それを実装した fork がありました.

ここから 0.90.72を ダウンロードしてインストールすると,~/.config/karabiner/karabiner.jsonstandalone_keys という設定を書けるようになります.最新の 0.90.76 は少なくとも僕の手元では正しく動いていませんでした.

{
    "profiles": [
        {
            "name": "Default profile",
            "devices": [],
            "fn_function_keys": {
                "f1": "display_brightness_decrement",
                "f10": "mute",
                "f11": "volume_decrement",
                "f12": "volume_increment",
                "f2": "display_brightness_increment",
                "f3": "mission_control",
                "f4": "launchpad",
                "f5": "illumination_decrement",
                "f6": "illumination_increment",
                "f7": "rewind",
                "f8": "play_or_pause",
                "f9": "fastforward"
            },
            "selected": true,
            "simple_modifications": {
                "caps_lock": "left_control",
                "grave_accent_and_tilde": "escape",
                "left_command": "left_command",
                "right_command": "right_command",
                "right_shift": "grave_accent_and_tilde"
            },
            "standalone_keys": {
                "left_control": "escape",
                "left_command": "japanese_eisuu",
                "right_command": "japanese_kana"
            },
            "virtual_hid_keyboard": {
                "caps_lock_delay_milliseconds": 0,
                "keyboard_type": "ansi",
                "standalone_keys_delay_milliseconds": 0
            }
        }
    ]
}

simple_modifications"left_command": "left_command" のように書いておくことで,デフォルト(モディファイアキーとして使うとき)では普通の左コマンドキーとして使い,単押しした時のみ standalone_keys の設定が使われ英数入力に切り替わります.

まとめるとこんな感じの設定になっています.

  • 左Cmd → 通常時は左Cmd,単押し時は英数キー
  • 右Cmd → 通常時は右Cmd,単押し時はかなキー
  • バッククォートキー → escape
  • 右Shift → バッククォートキー
  • capslock → 通常時は左Ctrl,単押し時は escape

この standalone_keys 拡張はすでに PR も出ていて,スレの長さから要望がかなりあるのも分かるのですが,メイン開発者の tekezo さんはまだ姿を見せていません.早くマージされるかそれ相当の機能が入ってほしい…

18
17
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
17