Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change caps_lock to control if pressed with other keys, to escape if pressed alone. But it also output control when pressed alone #3053

Closed
GanZhiXiong opened this issue Mar 26, 2022 · 1 comment

Comments

@GanZhiXiong
Copy link
Contributor

{
    "description": "Change caps_lock to control if pressed with other keys, to escape if pressed alone.",
    "manipulators": [
        {
            "type": "basic",
            "from": {
                "key_code": "caps_lock",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "left_control"
                }
            ],
            "to_if_alone": [
                {
                    "key_code": "escape"
                }
            ]
        }
    ]
}

But when you press caps_lock alone, it will output left_control first and then escape.

type:down            HID usage: 7,224     name:{"key_code":"left_control"}                             misc:flags left_control
type:up              HID usage: 7,224     name:{"key_code":"left_control"}                             misc:
type:down            HID usage: 7,41      name:{"key_code":"escape"}                                   misc:
type:up              HID usage: 7,41      name:{"key_code":"escape"}                                   misc:

Because left_control is mapped to the Windows win key, this will cause when caps_lock is pressed alone, the Windows start menu will be opened first, and then the escape will be pressed.

@GanZhiXiong
Copy link
Contributor Author

lazy 设置为 true 解决此问题。

"to": [{
  "key_code": "left_control",
  // lazy 默认值为 false,会导致按下 caps_lock 时,输出 left_control 和 escape。
  // 设置为 true 后,只有当按下 caps_lock 和其他按键时,才输出 left_control。
  "lazy": true
}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant