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

Trying to use Caps Lock as a function layer when held breaks its functionality when pressed #4090

Open
ohshitgorillas opened this issue Jan 5, 2025 · 1 comment

Comments

@ohshitgorillas
Copy link

ohshitgorillas commented Jan 5, 2025

My goal is to be able to use the Caps Lock key in two ways:

  • When pressed normally, as caps lock.
  • When held, it accesses a function layer that allows me to use ijkl as arrow keys.
    "description": "Hold CAPS LOCK for ijkl as Arrow Keys, Tap for Caps Lock",
    "manipulators": [
        {
            "from": {
                "key_code": "caps_lock",
                "modifiers": { "optional": ["any"] }
            },
            "to": [
                {
                    "set_variable": {
                        "name": "caps_lock_arrow_mode",
                        "value": 1
                    }
                }
            ],
            "to_after_key_up": [
                {
                    "set_variable": {
                        "name": "caps_lock_arrow_mode",
                        "value": 0
                    }
                }
            ],
            "to_if_alone": [
                {
                    "key_code": "caps_lock"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "name": "caps_lock_arrow_mode",
                    "type": "variable_if",
                    "value": 1
                }
            ],
            "from": {
                "key_code": "i",
                "modifiers": { "optional": ["any"] }
            },
            "to": [
                {
                    "key_code": "up_arrow"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "name": "caps_lock_arrow_mode",
                    "type": "variable_if",
                    "value": 1
                }
            ],
            "from": {
                "key_code": "j",
                "modifiers": { "optional": ["any"] }
            },
            "to": [
                {
                    "key_code": "left_arrow"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "name": "caps_lock_arrow_mode",
                    "type": "variable_if",
                    "value": 1
                }
            ],
            "from": {
                "key_code": "k",
                "modifiers": { "optional": ["any"] }
            },
            "to": [
                {
                    "key_code": "down_arrow"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "name": "caps_lock_arrow_mode",
                    "type": "variable_if",
                    "value": 1
                }
            ],
            "from": {
                "key_code": "l",
                "modifiers": { "optional": ["any"] }
            },
            "to": [
                {
                    "key_code": "right_arrow"
                }
            ],
            "type": "basic"
        }
    ]
}

this, however, simply breaks the caps lock functionality after a few seconds. I can use ijkl as arrow keys, but the regular caps lock functionality only lasts so long before it just 'breaks'.

What, if anything, am I doing wrong?

@tekezo
Copy link
Member

tekezo commented Jan 5, 2025

Since caps_lock requires a certain press duration, you need to modify to_if_alone as follows.

            "to_if_alone": [
                {
                    "hold_down_milliseconds": 200,
                    "key_code": "caps_lock"
                }
            ],

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

2 participants