karabiner – Is there a way to map a mouse button up action to a key press?

Spread the love


The following maps the left mouse button to perform C after selection:

    {
      "description": "MouseButton1 to Cmd+c: Copy",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "pointing_button": "button1",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to_if_alone": [
            {
              "pointing_button": "button1",
              "halt": true
            }
          ],
          "to_if_held_down": [
            {
              "pointing_button": "button1"
            }
          ],
          "to_after_key_up": [
            {
              "key_code": "c",
              "modifiers": [
                "command"
              ]
            }
          ]
        }
      ]
    }

Behavior of using this rule is a bit delayed. With the default Karabiner settings, you’ll have to wait a little bit after starting a selection and moving the mouse. Changing some Karabiner settings may help with this but may have other consequences (I’ve set to_if_alone_timeout_milliseconds to 200 and to_if_held_down_threshold_milliseconds to 200).

Author: Dhanraj7978

Leave a Reply

Your email address will not be published. Required fields are marked *