pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.72k stars 836 forks source link

CAPS LOCK modification broken in 12.3.0 #1831

Closed collenjones closed 5 years ago

collenjones commented 5 years ago

I use CAPS LOCK as Ctrl when used as a modifier and Esc when tapped and this no longer works after the 12.3.0 update.

maindoor commented 5 years ago

Exact same issue, but event-viewer says everything is great.

Screenshot at May 01 08-27-33

Here is my code:


                        "description": "Post escape if caps is pressed alone, right_ctrl otherwise",
                        "manipulators": [
                            {
                                "from": {
                                    "key_code": "caps_lock",
                                    "modifiers": {
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to": [
                                    {
                                        "key_code": "right_control"
                                    }
                                ],
                                "to_if_alone": [
                                    {
                                        "key_code": "escape"
                                    }
                                ],
                                "type": "basic"
                            }
                        ]
                    },
ikatza commented 5 years ago

I got it working again with version 12.3.4 downloaded from: https://github.com/tekezo/pqrs.org/tree/master/webroot/osx/karabiner/files

Had to reboot my system.

maindoor commented 5 years ago

@ikatza Nope still doesn't work for me. Can you post your related config ?

nickgravish commented 5 years ago

Agreed, 12.0 broke my caps lock hyper. Tried upgrading to 12.3.4 and rebooting but no luck.

ikatza commented 5 years ago

Not too sure about what you're asking for @maindoor. Yeah sure I can post my config if you let me know where to find it. Alternatively I can tell you that I just added Complex Modifications from the available rules.

maindoor commented 5 years ago

@ikatza all settings including complex modifications are stored at ~/.config/karabiner/karabiner.json I thought if I could see your working config I can compare with mine. My relevant config is posted above.

ikatza commented 5 years ago

The relevant part is:


{
    "description": "Change caps_lock to control if pressed with other keys, to escape if pressed alone.",
    "manipulators": [
        {
            "from": {
                "key_code": "caps_lock",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "left_control"
                }
            ],
            "to_if_alone": [
                {
                    "key_code": "escape"
                }
            ],
            "type": "basic"
        }
    ]
}
BrendanThompson commented 5 years ago

Yeah removing the modifiers section for to_if_alone is the key bit.

maindoor commented 5 years ago

@BrendanThompson I didn't fully understand your comment, can you please clarify ? What is the "key bit" to address this issue ?

BrendanThompson commented 5 years ago

@maindoor – let me clarify a bit better.

Take the below example of a complex_modification that was working prior to the update.

"complex_modifications": {
    "parameters": {
        "basic.to_delayed_action_delay_milliseconds": 500,
        "basic.to_if_alone_timeout_milliseconds": 1000,
        "basic.to_if_held_down_threshold_milliseconds": 500
    },
    "rules": [
        {
            "manipulators": [
                {
                    "description": "Change caps_lock to command+control+option+shift.",
                    "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"
                }
            ]
        }
    ]
}

I have extracted out the piece which is responsible for causing the Hyper-Key shortcut to fail, at least in my situation. Specifically out to the excerpt below the issue is the modifiers{} object. Further down I have taken an entry from the KE logs.

"to_if_alone": [
    {
        "key_code": "escape",
        "modifiers": {
            "optional": [
                "any"
            ]
        }
    }
],

From the logs it can be seen that the schema for the modifiers{} object has changed, if they're not required then remove the modifiers{} object from the config and refresh the conf, or alter it to match what is seemingly a new schema. I could however be wrong about this, I had a really quick look at some commits and couldn't see anything though; in saying that, I am not a C developer 😄

[2019-05-06 10:48:29.592] [error] [grabber] karabiner.json error: `to_if_alone` entry error: `modifiers` error: json must be array or string, but is `{"optional":["any"]}`
maindoor commented 5 years ago

@BrendanThompson Thanks for clarifying. FYI it did not help my case as I already didn't have the "modifiers" section in "to_if_alone" as per my config above.

BrendanThompson commented 5 years ago

@maindoor aahh bummer!

hng commented 5 years ago

@BrendanThompson Removing the modifiers object fixed it for me, thanks!

maindoor commented 5 years ago

I'm having to use the Touch Bar escape key. This is super frustrating, I've tried everything still can't get the Caps lock to work as escape. The only clue I see is that even when I quickly press caps lock, the even viewer shows both control and escape as shown in my previous post.

edit: this felt a little roundabout way of configuring but hey it works for me now: https://medium.com/@pechyonkin/how-to-map-capslock-to-control-and-escape-on-mac-60523a64022b

sabbatical commented 5 years ago

I had this issue on 12.3.0 (CAPSLOCK to "hyper key" mapping) and what solved it for me was simply removing the Complex Modifications rule that wasn't working, and then re-adding it. (Your mileage may vary?)

This probably removed the defunct json and replaced it with an updated version.

geewiz commented 5 years ago

see also: https://brettterpstra.com/2019/05/10/did-your-hyper-key-break/

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

esn89 commented 5 years ago

I haven't managed to get this to work, I have imported this rule:

Change caps_lock key (rev 4) -> Change caps_lock to control if pressed with other keys, to escape if pressed alone.

And still no luck.

Do I need to make any changes in the Keyboard -> Modifier Keys menu of my mac?

The json is here:

{
  "title": "Change caps_lock key (rev 4)",
  "rules": [
    {
      "description": "Change caps_lock key to command+control+option+shift if pressed with other keys",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_shift",
              "modifiers": [
                "left_command",
                "left_control",
                "left_option"
              ]
            }
          ],
          "to_if_alone": [
            {
              "hold_down_milliseconds": 100,
              "key_code": "caps_lock"
            }
          ]
        }
      ]
    },
    {
      "description": "Change caps_lock key to command+control+option+shift. (Post escape key when pressed alone)",
      "manipulators": [
        {
          "type": "basic",
          "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"
            }
          ]
        }
      ]
    },
    {
      "description": "Change caps_lock key to command+control+option+shift. (Post f19 key when pressed alone)",
      "manipulators": [
        {
          "type": "basic",
          "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": "f19"
            }
          ]
        }
      ]
    },
    {
      "description": "Change caps_lock key to command+control+option+shift. (Use shift+caps_lock as caps_lock)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_shift",
              "modifiers": [
                "left_command",
                "left_control",
                "left_option"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "Change caps_lock to control if pressed with other keys, to escape if pressed alone.",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "escape"
            }
          ]
        }
      ]
    },
    {
      "description": "Change caps_lock to control if pressed with other keys. (rev 2)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "caps_lock",
              "hold_down_milliseconds": 500
            }
          ]
        }
      ]
    },
    {
      "description": "Disable caps_lock delay (rev 1)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "vk_none"
            }
          ]
        }
      ]
    }
  ]
}