karabiner.json

林一二2020年06月22日 23:40
{
  "global": {
    "check_for_updates_on_startup": true,
    "show_in_menu_bar": true,
    "show_profile_name_in_menu_bar": false
  },
  "profiles": [
    {
      "complex_modifications": {
        "parameters": {
          "basic.simultaneous_threshold_milliseconds": 50,
          "basic.to_delayed_action_delay_milliseconds": 500,
          "basic.to_if_alone_timeout_milliseconds": 1000,
          "basic.to_if_held_down_threshold_milliseconds": 500,
          "mouse_motion_to_scroll.speed": 100
        },
        "rules": [
          {
            "manipulators": [
              {
                "description": "Change caps_lock to command+space to invoke IME switch if pressed alone.",
                "from": {
                  "key_code": "caps_lock",
                  "modifiers": {
                    "optional": ["any"]
                  }
                },
                "to_if_alone": [
                  {
                    "key_code": "spacebar",
                    "modifiers": ["left_command"]
                  }
                ],
                "type": "basic"
              }
            ]
          },
          {
            "description": "Change caps_lock to command+control+option+shift if pressed with other keys.",
            "manipulators": [
              {
                "type": "basic",
                "from": {
                  "key_code": "l",
                  "modifiers": {
                    "mandatory": ["option"]
                  }
                },
                "to": [
                  {
                    "key_code": "q",
                    "modifiers": ["left_control", "left_command"]
                  }
                ]
              }
            ]
          },
          {
            "description": "Change right_shift to command+left_shift if pressed with other keys, and toggle IME if pressed alone.",
            "manipulators": [
              {
                "type": "basic",
                "from": {
                  "key_code": "right_shift",
                  "modifiers": {
                    "optional": ["any"]
                  }
                },
                "to": [
                  {
                    "key_code": "left_shift",
                    "modifiers": ["left_command"]
                  }
                ],
                "to_if_alone": [
                  {
                    "key_code": "spacebar",
                    "modifiers": ["left_command"]
                  }
                ]
              }
            ]
          },
          {
            "description": "Lock screen using left_command + L instead of Ctrl + Command + Q",
            "manipulators": [
              {
                "type": "basic",
                "from": {
                  "key_code": "l",
                  "modifiers": ["left_command"]
                },
                "to": [
                  {
                    "key_code": "q",
                    "modifiers": ["left_command", "left_control"]
                  }
                ]
              }
            ]
          }
        ]
      },
      "devices": [],
      "fn_function_keys": [],
      "name": "Default profile",
      "parameters": {
        "delay_milliseconds_before_open_device": 1000
      },
      "selected": true,
      "simple_modifications": [],
      "virtual_hid_keyboard": {
        "country_code": 0,
        "mouse_key_xy_scale": 100
      }
    }
  ]
}
Code
{
  "global": {
    "check_for_updates_on_startup": true,
    "show_in_menu_bar": true,
    "show_profile_name_in_menu_bar": false
  },
  "profiles": [
    {
      "complex_modifications": {
        "parameters": {
          "basic.simultaneous_threshold_milliseconds": 50,
          "basic.to_delayed_action_delay_milliseconds": 500,
          "basic.to_if_alone_timeout_milliseconds": 1000,
          "basic.to_if_held_down_threshold_milliseconds": 500,
          "mouse_motion_to_scroll.speed": 100
        },
        "rules": [
          {
            "manipulators": [
              {
                "description": "Change caps_lock to command+space to invoke IME switch if pressed alone.",
                "from": {
                  "key_code": "caps_lock",
                  "modifiers": {
                    "optional": ["any"]
                  }
                },
                "to_if_alone": [
                  {
                    "key_code": "spacebar",
                    "modifiers": ["left_command"]
                  }
                ],
                "type": "basic"
              }
            ]
          },
          {
            "description": "Change caps_lock to command+control+option+shift if pressed with other keys.",
            "manipulators": [
              {
                "type": "basic",
                "from": {
                  "key_code": "l",
                  "modifiers": {
                    "mandatory": ["option"]
                  }
                },
                "to": [
                  {
                    "key_code": "q",
                    "modifiers": ["left_control", "left_command"]
                  }
                ]
              }
            ]
          },
          {
            "description": "Change right_shift to command+left_shift if pressed with other keys, and toggle IME if pressed alone.",
            "manipulators": [
              {
                "type": "basic",
                "from": {
                  "key_code": "right_shift",
                  "modifiers": {
                    "optional": ["any"]
                  }
                },
                "to": [
                  {
                    "key_code": "left_shift",
                    "modifiers": ["left_command"]
                  }
                ],
                "to_if_alone": [
                  {
                    "key_code": "spacebar",
                    "modifiers": ["left_command"]
                  }
                ]
              }
            ]
          },
          {
            "description": "Lock screen using left_command + L instead of Ctrl + Command + Q",
            "manipulators": [
              {
                "type": "basic",
                "from": {
                  "key_code": "l",
                  "modifiers": ["left_command"]
                },
                "to": [
                  {
                    "key_code": "q",
                    "modifiers": ["left_command", "left_control"]
                  }
                ]
              }
            ]
          }
        ]
      },
      "devices": [],
      "fn_function_keys": [],
      "name": "Default profile",
      "parameters": {
        "delay_milliseconds_before_open_device": 1000
      },
      "selected": true,
      "simple_modifications": [],
      "virtual_hid_keyboard": {
        "country_code": 0,
        "mouse_key_xy_scale": 100
      }
    }
  ]
}