MeetinaXD
@admin

用了接近半年的MacOS,从“不要不要”到“不要停不要停”,感觉现在已经习惯了它的键位。
但是仍然有一些非常反人类的操作(真的)
例如跳到行首行尾,在Windows上是Home和End。MacBook虽然没有这两个键(其实有,Fn+左箭头和Fn+右箭头对应的就是Home和End,但是按下去并没有用),但可以学习其他笔记本厂商的解决方案吧?
但Apple说不,这样不好。
于是这两个键在macOS上就变成了Ctrl+A和Ctrl+E
我他妈……

Karabiner-Elements这个神器就是为了解决这个问题的,说说改键史上最伟大的工具也不为过。
关于自定义规则,它的规则目录在:
~/.config/karabiner/assets/complex_modifications
中,按照官网文档直接将写好的规则命名为json后缀的文件放到里面即可。
废话少说,直接上规则。

如果不知道规则怎么编写,可以参考这篇文章:
Mac键位修改神器- karabiner-elements

映射规则表

按键被映射为功能说明
左Cmd+左方向键左Ctrl+A转到行首
左Cmd+右方向键左Ctrl+E转到行首
左Ctrl键单独按下CapsLock单独按下切换中英文
左Cmd+Esc左Cmd+\`切换同程序窗口

规则json

{
  "title": "MeetinaXD's rule",
  "rules": [{
      "description": "Change left_command + left_arrow to ctrl + a (move to the beginning of the line)",
      "manipulators": [{
        "type": "basic",
        "from": {
          "key_code": "left_arrow",
          "modifiers": {
            "mandatory": ["left_command"],
            "optional": ["any"]
          }
        },
        "to": [{
          "key_code": "a",
          "modifiers": [
            "left_control"
          ]
        }],
        "conditions": [{
          "type": "device_if",
          "identifiers": [{
            "vendor_id": 1452,
            "product_id": 637,
            "description": "internal keyboard"
          }]
        }]
      }]
    },
    {
      "description": "Change left_command + right_arrow to ctrl + e (move to the end of the line)",
      "manipulators": [{
        "type": "basic",
        "from": {
          "key_code": "right_arrow",
          "modifiers": {
            "mandatory": ["left_command"],
            "optional": ["any"]
          }
        },
        "to": [{
          "key_code": "e",
          "modifiers": [
            "left_control"
          ]
        }],
        "conditions": [{
          "type": "device_if",
          "identifiers": [{
            "vendor_id": 1452,
            "product_id": 637,
            "description": "internal keyboard"
          }]
        }]
      }]
    },
    {
      "description": "Change left_command + esc to left_command + ` (change window)",
      "manipulators": [{
        "type": "basic",
        "from": {
          "key_code": "escape",
          "modifiers": {
            "mandatory": ["left_command"],
            "optional": ["any"]
          }
        },
        "to": [{
          "key_code": "grave_accent_and_tilde",
          "modifiers": [
            "left_command"
          ]
        }]
      }]
    },
    {
      "description": "Change left control to capslock if taps alone",
      "manipulators": [{
        "type": "basic",
        "from": {
          "key_code": "left_control",
          "modifiers": {
            "optional": ["any"]
          }
        },
        "to": [{
          "key_code": "left_control"
        }],
        "to_if_alone": [{
          "key_code": "caps_lock"
        }]
      }]
    }
  ]
}

另外,最近发现一个相逢恨晚的功能。
在家我用笔记本比较多,hhkb比较贵不敢放外边所以我都随着电脑带。(毕竟高中时存了好久的钱)
所以每次当我在家用这个厚实分量大的键盘的时候,总会压到下面的键盘。

以前在Windows上我选择直接卸载内置键盘驱动
换mbp之后发现karabiner-elements内置了这样的一个功能

懂得都懂了,很舒服。

下午6:20 · 2020年12月06日
3579
2
0
发表留言

    zhao
    3年前

    thanks for your share , from a frontend engineer

    2年前

    其实不是苹果非要用Control+A和Control +E,而是苹果采用了emacs的规则。

笔记与分享
Karabiner-Elements 自定义规则分享
用了接近半年的MacOS,从“不要不要”到“不要停不要停”,感觉现在已经习惯了它的键位。但是仍然有一些非常反人类的操作(真的)例如跳到行首行...
扫描右侧二维码继续阅读
December 6, 2020
My Codes
blogger
meetinaxd
喜欢猪🐗
mylesson 作者
alovajs core dev
本质是一条野猪
你知道吗?

每吃一只卤🐽,就会有一条野猪失去它的鼻子
上方可以切换日夜模式

统计
文章:28 篇
分类:4 个
评论:5 条
运行时长:4年279天
by yoniu.
My Codes