Karabiner-Elements icon indicating copy to clipboard operation
Karabiner-Elements copied to clipboard

`variable_if` not working for `name`s with `-`

Open noel-yap opened this issue 2 years ago • 0 comments

The following will correctly launch Mission Control upon clicking right shift twice:

[
        {
          "type": "basic",
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "mission_control"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "key sequence",
              "value": "[right_shift]"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "optional": ["any"]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "key sequence",
                "value": "[right_shift]"
              }
            },
            {
              "key_code": "right_shift"
            }
          ],
          "to_delayed_action": {
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "key sequence",
                  "value": "[]"
                }
              }
            ],
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "key sequence",
                  "value": "[]"
                }
              }
            ]
          }
        }
      ]

But the following incorrectly launches Mission Control on a single click of right shift:

[
        {
          "type": "basic",
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "mission_control"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "key-sequence",
              "value": "[right_shift]"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "optional": ["any"]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "key-sequence",
                "value": "[right_shift]"
              }
            },
            {
              "key_code": "right_shift"
            }
          ],
          "to_delayed_action": {
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "key-sequence",
                  "value": "[]"
                }
              }
            ],
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "key-sequence",
                  "value": "[]"
                }
              }
            ]
          }
        }
      ]

noel-yap avatar Sep 20 '22 01:09 noel-yap