首页 » 操作系统 » macOS » 正文

把 Tab 变成 NumLock,为 MBP 增加一个数字小键盘

发布者:站点默认
2020/01/28 浏览数(722) 分类:macOS 把 Tab 变成 NumLock,为 MBP 增加一个数字小键盘已关闭评论

说明

当按住 Tab 时把右手的字母区域变为数字小键盘。uio/jkl/m,./空格cmd 依次对应 789/456/123/0.,详见下图:

用法

按住 Tab 不要松,之后按右手中数字对应的字母;单按 Tab 还是缩进功能;数字输入完成后松开 Tab 即可;

方法

karabiner-Elements 的 complex_modifications 配置文件:

{
  "title": "Numeric Keypad",
  "rules": [
    {
      "description": "按住 Tab 激活数字小键盘",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "tab"
          },
          "to": [
            {
              "set_variable": {
                "name": "numeric_keypad_mode",
                "value": 1
              }
            }
          ],
          "to_if_alone": [
            {
              "key_code": "tab"
            }
          ],
          "to_after_key_up": [
            {
              "set_variable": {
                "name": "numeric_keypad_mode",
                "value": 0
              }
            }
          ]
        }
      ]
    },
    {
      "description": "数字小键盘 [ SPACE as 0, CMD as .]",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "u"
          },
          "to": [
            {
              "key_code": "keypad_7"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "i"
          },
          "to": [
            {
              "key_code": "keypad_8"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "o"
          },
          "to": [
            {
              "key_code": "keypad_9"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "j"
          },
          "to": [
            {
              "key_code": "keypad_4"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "k"
          },
          "to": [
            {
              "key_code": "keypad_5"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "l"
          },
          "to": [
            {
              "key_code": "keypad_6"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "m"
          },
          "to": [
            {
              "key_code": "keypad_1"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "comma"
          },
          "to": [
            {
              "key_code": "keypad_2"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "period"
          },
          "to": [
            {
              "key_code": "keypad_3"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "spacebar"
          },
          "to": [
            {
              "key_code": "keypad_0"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_command"
          },
          "to": [
            {
              "key_code": "keypad_period"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "numeric_keypad_mode",
              "value": 1
            }
          ]
        }
      ]
    }
  ]
}
点击返回顶部
  1. 留言
  2. 联系方式