Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Last active March 30, 2022 18:03
Show Gist options
  • Select an option

  • Save ttscoff/06c26e5859093bd008b5cc16f5bbaa22 to your computer and use it in GitHub Desktop.

Select an option

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

jgclark commented Apr 3, 2019

Copy link
Copy Markdown

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

buzzert commented Apr 24, 2019

Copy link
Copy Markdown

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

bgoosman commented Apr 25, 2019

Copy link
Copy Markdown

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

@bgoosman

Copy link
Copy Markdown

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
Copy Markdown

@bgooseman´s solution worked for me. Thanks!

@jonpdw

jonpdw commented Aug 5, 2019

Copy link
Copy Markdown

@bgooseman Thanks for your solution

@vprsnc

vprsnc commented Mar 30, 2022

Copy link
Copy Markdown

Thank you! That helped!

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