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

Double click rule not working

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

The following correctly launches Mission Control upon double pressing right shift:

[
        {
          "type": "basic",
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "optional": ["caps_lock"]
            }
          },
          "to": [
            {
              "key_code": "mission_control"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "KEY_SEQUENCE",
              "value": "[right_shift]"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "optional": ["caps_lock"]
            }
          },
          "to_if_alone": [
            {
              "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": "[]"
                }
              }
            ]
          }
        }
      ]

The following has double click behaving as it usually does (ie selecting a word):

[
        {
          "type": "basic",
          "from": {
            "pointing_button": "button1",
            "modifiers": {
              "optional": ["caps_lock"]
            }
          },
          "to": [
            {
              "key_code": "mission_control"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "KEY_SEQUENCE",
              "value": "[button1]"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "pointing_button": "button1",
            "modifiers": {
              "optional": ["caps_lock"]
            }
          },
          "to_if_alone": [
            {
              "set_variable": {
                "name": "KEY_SEQUENCE",
                "value": "[button1]"
              }
            },
            {
              "pointing_button": "button1"
            }
          ],
          "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