LoginSignup
0
0

More than 1 year has passed since last update.

Karabiner-Elements を使ってキー割当。

Last updated at Posted at 2022-01-03

iMac で Windows のようなキー配置

やりたいこと

  • Mac キーボードを Windows 化

    • CommandControlを入れ変えたい!
    • Win 歴が長いため、Control+Tabなどで画面切り替えがしたい。
    • Command+CCommand+Vなどのコピペ、切り取り、1つ戻る、1つ進むを
      Control+CControl+Vに変更したい!
    • Chorome のタブ移動をCommand+数字キーからControl+数字キーに変更したい!
  • 絵文字と記号のパレットをControl+Command+SpaceからControl+Shift+Tabに変更したい

  • Command+左右キーでの仮想ディスプレイの行き来をControl+左右キーに割り振りたい


動作環境

  • iMac Late 2012

    • macOS Catalina v10.15.7

スクリーンショット 2022-01-03 10.59.09.png

  • Karabiner-Elements v12.10.0

スクリーンショット 2022-01-03 11.10.38.png

  • キーボード: Keychron K8

  • Karabiner-Elements v12.10.0

大半はこれで解決

スクリーンショット 2022-01-03 11.41.09.png

CommandControlの入れ替えは上記の GUI 操作で解決。
Command+Z,X,C,V,YControl+Z,X,C,V,Yで出来るようになった。


実際にコーディング

タブ切り替え

ファイルを ~/.config/karabiner/assets/complex_modificationsに json ファイルを置く。

  • Karabiner-Elements のいつかのバージョンからcomplex_modificationsに置く
    json ファイル名は数字でしか認識されなくなったらしい
{
    "title": "タブ切り替え",
    "rules": [{
            "description": "タブ切り替え command + tab",
            "manipulators": [{
                    "type": "basic",
                    "from": {
                        "key_code": "tab",
                        "modifiers": {"mandatory": ["control"]}
                    },
                    "to":[{
                        "key_code": "tab",
                        "modifiers": ["command"]
                    }]
                }
            ]
        }
    ]
}

GUI でCommandControlを入れ替えただけじゃできなかったので、これで解決。


絵文字と記号パレット

ショートカットの変更

{
    "title": "絵文字と記号",
    "rules": [{
            "description": "絵文字と記号 Ctrl+Shift+Space",
            "manipulators": [{
                    "type": "basic",
                    "from": {
                        "key_code": "spacebar",
                        "modifiers": {"mandatory": ["command", "control"]}
                    },
                    "to":[{
                        "key_code": "spacebar",
                        "modifiers": ["command", "shift"]
                    }]
                }
            ]
        }
    ]
}

これで書いてみたけど、なぜか適応されない。

救済措置としては、macOS Catalina では、  
「システム環境設定 > キーボード > ショートカット > アプリケーション」に  
絵文字と記号を自分で追加してショートカットを割り振る。

qiita.gif

一応これで解決したけど、  
Karabiner-Elements 使えてないし、コードが適応されないのが謎。


仮想ディスプレイのキー割当

私は、「大半はこれで解決」の  
Karabiner-Elements の Simple modificationsで、ControlCommandを逆にしているので、

{
    "title": "画面移動",
    "rules": [
        {
            "description": "画面移動 Control+右",
            "manipulators": [{
                    "type": "basic",
                    "from": {
                        "key_code": "right_arrow",
                        "modifiers": {"mandatory": [ "control"]}
                    },
                    "to":[{
                        "key_code": "right_arrow",
                        "modifiers": ["command"]
                    }]
                }
            ]
        },
        {
            "description": "画面移動 Control+左",
            "manipulators": [{
                    "type": "basic",
                    "from": {
                        "key_code": "left_arrow",
                        "modifiers": {"mandatory": [ "control"]}
                    },
                    "to":[{
                        "key_code": "left_arrow",
                        "modifiers": ["command"]
                    }]
                }
            ]
        }
    ]
}

と書いてみた。

一応、Complex modificationsRulesには表示がされたが…。

スクリーンショット 2022-01-03 17.57.03.png

タブ移動ができなくなりあえなく Remove…。

もうどうしたらいいのかわからん!!!笑

だれか、Karabiner-Elements のスペシャリストに助けてほしいレベル…。

以上、備忘用というか、誰得な事してみました。

0
0
0

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
0
0