Karabiner-elements: How to map 1 key to simulate holding down multiple keys?

Created on 10 Nov 2018  Â·  8Comments  Â·  Source: pqrs-org/Karabiner-Elements

For example, holding down MouseButton4 would simulate holding down Up Arrow and Right Arrow at the same time? Is this possible?

My current implementation presses the to keys in order. For example, holding down MouseButton4 would press the Up Arrow then release it then holds the Right arrow. Any help?

{  
                    "type":"basic",
                    "from":{  
                        "pointing_button":"button4",
                        "modifiers":{  
                            "optional":[  
                                "any"
                            ]
                        }
                    },
                    "to": [
                        {  
                            "key_code":"up_arrow"
                        },
                        {
                            "key_code":"right_arrow"
                        }
                    ]
}
stale

All 8 comments

I don't understand what you want your rule to do: It's logically not possible to "use" two arrow keys at once.
WHAT do you expect to achieve _actually?_

I have the same question. For example, I would like the grave_accent_and_tildekey to simulate a simultaneous shift and grave_accent_and_tilde press. The intended result would be producing a tilde with a single keystroke.

@ iliaskarim, I think your question is a little different as you want a modifier "shift" and a "normal" key to be collaborative at the same time.
That can be done by "to": [{ "key_code": "grave_accent_and_tilde", "modifiers": ["left_shift"] }] while chrisngn wants to press two non-collaborative "key_codes" simultaneously.

WHY would you press two arrow keys at the same time in a "to" expression ?
... I don't understand what's his purpose with this. You cannot press e.g. "A" and "B" at once – _WHICH letter_ would be the _result_ ?!?

At the day's end: _"simultaneous-ness" only makes sense in a "from" expression._

I want to achieve something like click button4, which sends up_arrow down,
right_arrow down. And it doesn't release until I let go of button4, which
then it sends right_arrow up, up_arrow up.

On Thu, Nov 15, 2018, 3:38 AM clemsam notifications@github.com wrote:

I don't understand what you want your rule to do: It's logically not
possible to "use" two arrow keys at once.
WHAT do you expect to achieve actually?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tekezo/Karabiner-Elements/issues/1637#issuecomment-438960583,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJ8qV6RuCgELFd1PfTkXyernq3dY2NW5ks5uvSgWgaJpZM4YXtb2
.

So if I understand you right, if you press and hold button4 not _BOTH_ arrows are kept down together, right? One of them is released, the other not?

Is it that you want to have them both release _TOGETHER_ at the exact moment when you release button4 (but _STILL_ one after the other)?

There is a component "strict" that might help you as it keeps buttons' behaviour in _strict order_.
If that does not help you you can "osascript" AppleScript commands that use "key down" and "key up".

(I am sorry that at the moment I haven't got the time to test these options, but I will do so later if you don't report success yourself...)

If I may interject again, isn't @chrisngn's idea to have a single key move up-right?

@clemsam thank you for your courteous response. Do you know of a way to set such a complex modification via the Karabiner-Elements GUI?

Documentation alludes to making rules

You can import predefined rules from the internet (or make your own rules).

but the option is not present anywhere, only getting rules from https://pqrs.org/osx/karabiner/complex_modifications/

(I'll answer your 2nd question, as I am not quite clear what exactly the 1st refers to.)

If you want to import a rule via K-E's GUI and _NOT_ get it from the web, you got to write it yourself (easiest: duplicate & change an existing one) and simply put the text file (saved with a .json extension) into your own [ user name ] > .config > karabiner > assets > complex_modifications folder.

If you then start K-E, open tab "Complex Modifications", click button [+ Add rule], your new rule will be visible somewhere in the scroll area – you just have to select [Enable], it will be copied into your karabiner > karabiner.json file and be effective immediately.
If your "rule" does _NOT_ appear in the list – something in the .json file is "broken"…

Here is code that does about what you wish:

{ "title": "Rule to get grave_accent_and_tilde with one keystroke",
  "rules": [
     { "description": "grave_accent_and_tilde with one keystroke",
      "manipulators": [ {
                "from": { "key_code": "grave_accent_and_tilde" },
                  "to": [
                          { "key_code": "grave_accent_and_tilde",
                            "modifiers": ["left_shift"]  }],
                "type": "basic"  }
 ]    }    ]    }

Paste this into TextEdit and save as Any_name_you_want.json …

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.

Was this page helpful?
0 / 5 - 0 ratings