Karabiner-Elements で Mac を Ubuntu 風(Gnome)にする

参考

Karabiner-Elementsの設定項目をまとめました - Qiita

Karabiner-Elements で特定のアプリにだけキーバインドを変更する - モノラルログ

 json

{
  "title": "MacをUbuntu風に操作する",
  "rules": [
      {
          "description": "hold terminal ctrl",
          "manipulators": [
              {
                  "type": "basic",
                  "conditions": [
                      {
                          "type": "frontmost_application_if",
                          "bundle_identifiers": [
                              "^com\\.apple\\.Terminal"
                          ]
                      }
                  ],
                  "from": {
                      "key_code": "left_control",
                      "modifiers": {
                          "optional": [
                              "any"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "right_control"
                      }
                  ]
              },
              {
                  "type": "basic",
                  "conditions": [
                      {
                          "type": "frontmost_application_if",
                          "bundle_identifiers": [
                              "^com\\.apple\\.Terminal"
                          ]
                      }
                  ],
                  "from": {
                      "key_code": "c",
                      "modifiers": {
                          "mandatory": [
                              "control",
                              "shift"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "c",
                          "modifiers": [
                              "left_command"
                          ]
                      }
                  ]
              },
              {
                  "type": "basic",
                  "conditions": [
                      {
                          "type": "frontmost_application_if",
                          "bundle_identifiers": [
                              "^com\\.apple\\.Terminal"
                          ]
                      }
                  ],
                  "from": {
                      "key_code": "v",
                      "modifiers": {
                          "mandatory": [
                              "control",
                              "shift"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "v",
                          "modifiers": [
                              "left_command"
                          ]
                      }
                  ]
              }
          ]
      },
      {
          "description": "全角半角でIME切り替え",
          "manipulators": [
              {
                  "type": "basic",
                  "conditions": [
                      {
                          "input_sources": [
                              {
                                  "language": "ja"
                              }
                          ],
                          "type": "input_source_if"
                      }
                  ],
                  "from": {
                      "key_code": "grave_accent_and_tilde",
                      "modifiers": {
                          "optional": [
                              "any"
                          ]
                      }
                  },
                  "parameters": {
                      "basic.to_if_held_down_threshold_milliseconds": 100
                  },
                  "to_if_alone": [
                      {
                          "key_code": "japanese_eisuu"
                      }
                  ]
              },
              {
                  "type": "basic",
                  "conditions": [
                      {
                          "input_sources": [
                              {
                                  "language": "en"
                              }
                          ],
                          "type": "input_source_if"
                      }
                  ],
                  "from": {
                      "key_code": "grave_accent_and_tilde",
                      "modifiers": {
                          "optional": [
                              "any"
                          ]
                      }
                  },
                  "parameters": {
                      "basic.to_if_held_down_threshold_milliseconds": 100
                  },
                  "to_if_alone": [
                      {
                          "key_code": "japanese_kana"
                      }
                  ]
              }
          ]
      },
      {
          "description": "map left_control to command",
          "manipulators": [
              {
                  "from": {
                      "key_code": "left_control",
                      "modifiers": {
                          "optional": [
                              "left_shift"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "left_command"
                      }
                  ],
                  "type": "basic"
              }
          ]
      },
      {
          "description": "Maps Alt+Tab to Cmd+Tab",
          "manipulators": [
              {
                  "from": {
                      "key_code": "tab",
                      "modifiers": {
                          "mandatory": [
                              "left_alt"
                          ],
                          "optional": [
                              "left_shift"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "tab",
                          "modifiers": [
                              "right_command"
                          ]
                      }
                  ],
                  "type": "basic"
              },
              {
                  "from": {
                      "key_code": "left_shift",
                      "modifiers": {
                          "mandatory": [
                              "left_alt"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "left_shift",
                          "modifiers": [
                              "right_command"
                          ]
                      }
                  ],
                  "type": "basic"
              },
              {
                  "from": {
                      "key_code": "escape",
                      "modifiers": {
                          "mandatory": [
                              "left_alt"
                          ],
                          "optional": [
                              "left_shift"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "escape",
                          "modifiers": [
                              "left_command"
                          ]
                      }
                  ],
                  "type": "basic"
              }
          ]
      },
      {
          "description": "retrieve ctrl BS <- cmd BS",
          "manipulators": [
              {
                  "from": {
                      "key_code": "delete_or_backspace",
                      "modifiers": {
                          "mandatory": [
                              "left_command"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "delete_or_backspace",
                          "modifiers": [
                              "left_control"
                          ]
                      }
                  ],
                  "type": "basic"
              }
          ]
      },
      {
          "description": "retrieve ctrl tab <- cmd tab",
          "manipulators": [
              {
                  "from": {
                      "key_code": "tab",
                      "modifiers": {
                          "mandatory": [
                              "left_command"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "tab",
                          "modifiers": [
                              "left_control"
                          ]
                      }
                  ],
                  "type": "basic"
              },
              {
                  "from": {
                      "key_code": "tab",
                      "modifiers": {
                          "mandatory": [
                              "left_command",
                              "left_shift"
                          ]
                      }
                  },
                  "to": [
                      {
                          "key_code": "tab",
                          "modifiers": [
                              "left_control",
                              "left_shift"
                          ]
                      }
                  ],
                  "type": "basic"
              }
          ]
      }
  ]
}
{
  "title": "key settings",
  "rules": [
      {
          "description": "etc",
          "manipulators": [
              {
                  "type": "basic",
                  "conditions": [
                      {
                          "type": "frontmost_application_if",
                          "bundle_identifiers": [
                              "^com\\.apple\\.Terminal"
                          ]
                      }
                  ],
                  "from": {
                      "key_code": "international5"
                  },
                  "to": [
                      {
                          "key_code": "right_control"
                      }
                  ]
              },
              {
                  "type": "basic",
                  "from": {
                      "key_code": "international1"
                  },
                  "to": [
                      {
                          "key_code": "international3"
                      }
                  ]
              },
              {
                  "type": "basic",
                  "from": {
                      "key_code": "international5"
                  },
                  "to": [
                      {
                          "key_code": "left_command"
                      }
                  ]
              },
              {
                  "type": "basic",
                  "from": {
                      "key_code": "international5"
                  },
                  "to": [
                      {
                          "key_code": "left_command"
                      }
                  ]
              },
              {
                  "type": "basic",
                  "from": {
                      "key_code": "international4"
                  },
                  "to": [
                      {
                          "key_code": "escape"
                      }
                  ]
              },
              {
                  "type": "basic",
                  "from": {
                      "key_code": "international2"
                  },
                  "to": [
                      {
                          "key_code": "international1",
                          "modifiers": [
                              "left_shift"
                          ]
                      }
                  ]
              },
              {
                  "type": "basic",
                  "from": {
                      "key_code": "international3"
                  },
                  "to": [
                      {
                          "key_code": "4",
                          "modifiers": [
                              "left_shift"
                          ]
                      }
                  ]
              }
          ]
      }
  ]
}
{
    "title": "Caps を Fn にしつつ、かっこよく使う",
    "rules": [
        {
            "description": "caps hjkl for arrow",
            "manipulators": [
                {
                    "type": "basic",
                    "from": {
                        "key_code": "caps_lock"
                    },
                    "to": [
                        {
                            "key_code": "fn"
                        }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "h",
                        "modifiers": {
                            "mandatory": [
                                "fn"
                            ]
                        }
                    },
                    "to": [
                        {
                            "key_code": "left_arrow"
                        }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "j",
                        "modifiers": {
                            "mandatory": [
                                "fn"
                            ]
                        }
                    },
                    "to": [
                        {
                            "key_code": "down_arrow"
                        }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "k",
                        "modifiers": {
                            "mandatory": [
                                "fn"
                            ]
                        }
                    },
                    "to": [
                        {
                            "key_code": "up_arrow"
                        }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "l",
                        "modifiers": {
                            "mandatory": [
                                "fn"
                            ]
                        }
                    },
                    "to": [
                        {
                            "key_code": "right_arrow"
                        }
                    ]
                }
            ]
        }
    ]
}
{
    "title": "yabai の設定",
    "rules": [
        {
            "description": "cmd arrows",
            "manipulators": [
                {
                    "type": "basic",
                    "from": {
                        "key_code": "left_command"
                    },
                    "to": [
                      {
                          "key_code": "right_command"
                      }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "b",
                        "modifiers": {
                            "mandatory": [
                                "right_command"
                            ]
                        }
                    },
                    "to": [
                        { "shell_command": "/usr/local/bin/yabai -m space --layout bsp" }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "b",
                        "modifiers": {
                            "mandatory": [
                                "right_command"
                            ]
                        }
                    },
                    "to": [
                        { "shell_command": "/usr/local/bin/yabai -m space --layout bsp" }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "down_arrow",
                        "modifiers": {
                            "mandatory": [
                                "right_command"
                            ]
                        }
                    },
                    "to": [
                        { "shell_command": "/usr/local/bin/yabai -m space --layout bsp" }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "f",
                        "modifiers": {
                            "mandatory": [
                                "right_command"
                            ]
                        }
                    },
                    "to": [
                        { "shell_command": "/usr/local/bin/yabai -m space --layout float" }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "up_arrow",
                        "modifiers": {
                            "mandatory": [
                                "right_command"
                            ]
                        }
                    },
                    "to": [
                        { "shell_command": "/usr/local/bin/yabai -m window --grid 1:1:0:0:1:1" }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "left_arrow",
                        "modifiers": {
                            "mandatory": [
                                "right_command"
                            ]
                        }
                    },
                    "to": [
                        { "shell_command": "/usr/local/bin/yabai -m window --grid 1:2:0:0:1:1" }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "right_arrow",
                        "modifiers": {
                            "mandatory": [
                                "right_command"
                            ]
                        }
                    },
                    "to": [
                        { "shell_command": "/usr/local/bin/yabai -m window --grid 1:2:1:0:1:1" }
                    ]
                },
                {
                    "type": "basic",
                    "from": {
                        "key_code": "r",
                        "modifiers": {
                            "mandatory": [
                                "right_command"
                            ]
                        }
                    },
                    "to": [
                        { "shell_command": "/usr/local/bin/yabai -m space --rotate 90" }
                    ]
                }
            ]
        }
    ]
}