Karabiner-elements: Version 12 broke complex modification

Created on 14 Apr 2018  路  9Comments  路  Source: pqrs-org/Karabiner-Elements

I just updated to version 12 and now the complex modification:

{
"from": {
"key_code": "semicolon",
"modifiers": {
"mandatory": [
"left_shift"
]
}
},
"to": [
{
"key_code": "semicolon",
"modifiers": [
"caps_lock"
]
}
],
"to_if_alone": [
{
"key_code": "caps_lock"
}
],
"type": "basic"
}

does not work anymore. On the Swiss keyboard the caps_lock + semicolon should output a capital 脰 but only a 枚 is generated. A key modification takes place, but somehow the caps_lock gets lost. This worked in the previous version.

Most helpful comment

Thank you for feedback.

Since v12.0.0, Karabiner-Elements's virtual keyboard acts like the real hardware keyboard.
Thus, macOS ignores the short press on caps lock.

We need to held down caps lock.
I added hold_down_milliseconds parameter in the v12.0.2.

Upgrade to the latest beta version.
Check for beta updates

Then use hold_down_milliseconds as follows.

{
    "from": {
        "key_code": "semicolon",
        "modifiers": {
            "mandatory": [
                "left_shift"
            ],
            "optional": [
                "caps_lock"
            ]
        }
    },
    "to": [
        {
            "key_code": "semicolon"
        }
    ],
    "to_if_alone": [
        {
            "key_code": "caps_lock",
            "hold_down_milliseconds": 500
        }
    ],
    "type": "basic"
}

All 9 comments

I got the similar situation for binding capslock to emit capslock if press alone, and control if as a modifier.

FWIW, I did use Karabiner-EventViewer to monitor the events. In 11.6.0 I'll get two control events and one caps lock events when pressing alone. But in 12.0.1 I'll get two control events and two caps lock events. But still, caps lock doesn't actually work in 12.0.1.

Thank you for feedback.

Since v12.0.0, Karabiner-Elements's virtual keyboard acts like the real hardware keyboard.
Thus, macOS ignores the short press on caps lock.

We need to held down caps lock.
I added hold_down_milliseconds parameter in the v12.0.2.

Upgrade to the latest beta version.
Check for beta updates

Then use hold_down_milliseconds as follows.

{
    "from": {
        "key_code": "semicolon",
        "modifiers": {
            "mandatory": [
                "left_shift"
            ],
            "optional": [
                "caps_lock"
            ]
        }
    },
    "to": [
        {
            "key_code": "semicolon"
        }
    ],
    "to_if_alone": [
        {
            "key_code": "caps_lock",
            "hold_down_milliseconds": 500
        }
    ],
    "type": "basic"
}

@tekezo Appreciate your blazing fast fixing. 12.0.2 works for me. Thank you! 鉂わ笍 馃挋 馃挌 馃挏 馃挍

Thank you very much for the very fast reply.

Unfortunately, the modified json-script with Version 12.0.2 does not work for me. If I press now left shift + semikolon, the caps_lock is turn on permanently.

I want to change: left_shift + semikolon to caps_lock + semikolon, without having the caps_lock turned on afterwards... The caps_lock must be pressed simultaneously with semikolon. It looks like that this is done now sequentially.

I changed held_down_milliseconds -> hold_down_milliseconds at v12.0.3.
(We can use both held_down_milliseconds and hold_down_milliseconds in json.)

@JB74

This json should work.

{
    "from": {
        "key_code": "semicolon",
        "modifiers": {
            "mandatory": [
                "left_shift"
            ]
        }
    },
    "to": [
        {
            "key_code": "caps_lock",
            "held_down_milliseconds": 100
        },
        {
            "key_code": "semicolon"
        },
        {
            "key_code": "caps_lock",
            "held_down_milliseconds": 100
        }
    ],
    "type": "basic"
}

@tekezo: Thank you very, very much. It works now.

Similar problem here. Was working before v12.
Updated to beta 12.0.5.
The following works for the hyperkey part but the caps_lock doesn't work anymore :

{
    "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": "caps_lock",
             "held_down_milliseconds": 500
         }
     ],
     "type": "basic"
}

Now three questions :

  1. Have I missed something in the code ?
  2. Do I need to modify basic parameters (timeout, threshold, delay) from their default values ?
  3. What is the correct caps_lock setting in System Preference for both internal keyboard and Karabiner virtual keyboard ? Should it be set to "no action" for every devices ?

Thanks.

@maclm Your json works fine on my machine.
What's result on EventViewer when you press caps lock key?

Do I need to modify basic parameters (timeout, threshold, delay) from their default values ?

No, you don't need to modify basic parameters.

What is the correct caps_lock setting in System Preference for both internal keyboard and Karabiner virtual keyboard ? Should it be set to "no action" for every devices ?

No, you don't have to change the System Preferences > Keyboard > Modifiers.

@tekezo funny enough, it works this morning...
So, the output looks like this :

eventType:key_down        code:0xe3       name:left_gui        misc:
eventType:key_down        code:0xe0       name:left_control    misc:
eventType:key_down        code:0xe2       name:left_alt        misc:
eventType:key_down        code:0xe1       name:left_shift      misc:
eventType:key_up          code:0xe1       name:left_shift      misc:
eventType:key_up          code:0xe0       name:left_control    misc:
eventType:key_up          code:0xe2       name:left_alt        misc:
eventType:key_up          code:0xe3       name:left_gui        misc:
eventType:key_down        code:0x39       name:caps_lock       misc:
eventType:key_up          code:0x39       name:caps_lock       misc:

...with a delay before the last line appears.
I guess it is related to "held_down_milliseconds": 500.

Anyway, it works so my Mac and I are back on track now.
Thanks for your time.
Best regards.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baurmatt picture baurmatt  路  3Comments

jason0342 picture jason0342  路  3Comments

impala75 picture impala75  路  3Comments

DanweDE picture DanweDE  路  3Comments

aniude picture aniude  路  3Comments