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

Version 12 broke complex modification #1349

Closed
JB74 opened this issue Apr 14, 2018 · 9 comments
Closed

Version 12 broke complex modification #1349

JB74 opened this issue Apr 14, 2018 · 9 comments

Comments

@JB74
Copy link

JB74 commented Apr 14, 2018

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.

@taiansu
Copy link

taiansu commented Apr 14, 2018

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.

@tekezo
Copy link
Member

tekezo commented Apr 15, 2018

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"
}

@taiansu
Copy link

taiansu commented Apr 15, 2018

@tekezo Appreciate your blazing fast fixing. 12.0.2 works for me. Thank you! ❤️ 💙 💚 💜 💛

@JB74
Copy link
Author

JB74 commented Apr 15, 2018

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.

@tekezo
Copy link
Member

tekezo commented Apr 16, 2018

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"
}

@JB74
Copy link
Author

JB74 commented Apr 16, 2018

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

@JB74 JB74 closed this as completed Apr 16, 2018
@maclm
Copy link

maclm commented Apr 17, 2018

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.

@tekezo
Copy link
Member

tekezo commented Apr 18, 2018

@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.

@maclm
Copy link

maclm commented Apr 18, 2018

@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.

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

4 participants