Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Last active March 30, 2022 18:03
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ttscoff/06c26e5859093bd008b5cc16f5bbaa22 to your computer and use it in GitHub Desktop.
Save ttscoff/06c26e5859093bd008b5cc16f5bbaa22 to your computer and use it in GitHub Desktop.
Karabiner Elements hyper key with escape
"complex_modifications": {
"rules": [
{
"manipulators": [
{
"description": "Change caps_lock to command+control+option+shift. Escape if no other key used.",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_shift",
"modifiers": [
"left_command",
"left_control",
"left_option"
]
}
],
"to_if_alone": [
{
"key_code": "escape",
"modifiers": {
"optional": [
"any"
]
}
}
],
"type": "basic"
}
]
}
]
},
@jgclark
Copy link

jgclark commented Apr 3, 2019

When I try this I get the following Log error from Karabiner-Elements (v):

[2019-04-03 20:51:08.064] [error] [grabber] karabiner.json error: to_if_alone entry error: modifiers error: json must be array or string, but is {"optional":["any"]}

@buzzert
Copy link

buzzert commented Apr 24, 2019

This appears to be a recent regression (probably in 12.3.0). I have complex modifications like this that stopped working after upgrading. Removing the modifiers entry is not sufficient, because it will stop recognizing the defined keycode if any other modifier is pressed.

@bgoosman
Copy link

bgoosman commented Apr 25, 2019

I just ran into this after updating Karabiner-Elements to 12.3.0

@bgoosman
Copy link

I found that deleting the "modifiers" property from the "from" and "to_if_alone" directives solved the problem.

            "complex_modifications": {
                "rules": [
                    {
                        "manipulators": [
                            {
                                "description": "Change caps_lock to command+control+option+shift.",
                                "from": {
                                    "key_code": "caps_lock"
                                },
                                "to": [
                                    {
                                        "key_code": "left_shift",
                                        "modifiers": [
                                            "left_command",
                                            "left_control",
                                            "left_option"
                                        ]
                                    }
                                ],
                                "to_if_alone": [
                                    {
                                        "key_code": "escape"
                                    }
                                ],
                                "type": "basic"
                            }
                        ]
                    }
                ]
            }

@flegfleg
Copy link

@bgooseman´s solution worked for me. Thanks!

@jonpdw
Copy link

jonpdw commented Aug 5, 2019

@bgooseman Thanks for your solution

@vprsnc
Copy link

vprsnc commented Mar 30, 2022

Thank you! That helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment