Karabiner-Elements icon indicating copy to clipboard operation
Karabiner-Elements copied to clipboard

caps-lock to hyper key doesn't work

Open CraigglesO opened this issue 2 years ago • 4 comments

I might be doing this a bit wrong, but I want caps lock to be delete if pressed alone, but hyper key if pressed with other keys. When I play in Ukelele I see that its working to the point that I see the hyper key map, but it doesn't listen to the following keypress that joins with caps_lock.

{
                        "description": "Caps Lock → Hyper Key (⌃⌥⇧⌘) (Delete if alone)",
                        "manipulators": [
                            {
                                "from": {
                                    "key_code": "caps_lock"
                                },
                                "to": [
                                    {
                                        "key_code": "left_shift",
                                        "modifiers": [
                                            "left_option",
                                            "left_command",
                                            "left_control"
                                        ]
                                    }
                                ],
                                "to_if_alone": [
                                    {
                                        "key_code": "delete_or_backspace"
                                    }
                                ],
                                "parameters": {
                                    "basic.to_if_alone_timeout_milliseconds": 200
                                },
                                "type": "basic"
                            }
                        ]
                    }

CraigglesO avatar Aug 16 '22 14:08 CraigglesO

May need to add some modifiers to from.modifiers.optional. Perhaps, caps_lock or any. I am not sure.

MuhammedZakir avatar Aug 16 '22 15:08 MuhammedZakir

Appreciate the suggestion, but I don't think that's it (edited with optional any). If I bind caps_lock to ONLY "left_option" and bind keys to "left_option"+"key" it works.

It seems like the issue is when I have key_code + modifiers for my "to"... I hope I'm wrong.

CraigglesO avatar Aug 16 '22 16:08 CraigglesO

What does EventViewer show when you press caps_lock+<a key> after the modification?

MuhammedZakir avatar Aug 16 '22 16:08 MuhammedZakir

It's definitely working for Karabiner. If I do mapping via Karabiner it works

"manipulators": [
                            {
                                "from": {
                                    "key_code": "caps_lock",
                                    "modifiers": {
                                        "optional": ["any"]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "left_shift",
                                        "modifiers": [
                                            "left_control",
                                            "left_option",
                                            "left_command"
                                        ]
                                    }
                                ],
                                "to_if_alone": [
                                    {
                                        "key_code": "delete_or_backspace"
                                    }
                                ],
                                "parameters": {
                                    "basic.to_if_alone_timeout_milliseconds": 250
                                },
                                "type": "basic"
                            },
                            {
                                "from": {
                                    "key_code": "l",
                                    "modifiers": {
                                        "mandatory": [
                                            "left_shift",
                                            "left_control",
                                            "left_option",
                                            "left_command"
                                        ],
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "q"
                                    }
                                ],
                                "type": "basic"
                            }
                        ]

I'm starting to wonder if it's a bug with MacOS/Ukelele? I'm not going to figght it. Just going to create all the mappings I want this way.

I appreciate your time though.

CraigglesO avatar Aug 16 '22 17:08 CraigglesO