-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I remap a combination of keys to a single key? #4
Comments
No, I haven't had this use-case so I didn't implement it. |
Ok, I see. Would it be hard to implement N:1 mappings? |
It wouldn't be terribly hard - the main thing is you have to make the event mapping logic stateful as you need to track multiple keys being held down, and each of those is a separate event. There's a smaller problem of how you express a combination in the config syntax, but that can be solved for sure. I'm not particularly motivated to implement this, but I'll happily take a PR for it. |
I am also interested in a feature like this. Maybe the easiest way to implement this is using the following function? if you want to remap Ctrl+s, you could check after each s-event whether the ctrl key is active, and only do the remapping in that case. No idea if this actually could work. |
That helps solve the event mapping. Still need to come up with an efficient config expression. |
I quickly hacked a way to handle N:N mappings: The input keys can be specified as a "tuple" in a config file, e.g.:
All additional keys are simply passed from the input to the output, e.g. Shift+F1 will become Shift+BTN_LEFT and Shift+Meta+F1 will become Shift+Ctrl+F5. Also, since I needed it, I added some basic functionality that allows remappings to be conditioned on the active window class (for X11 only for now), e.g.:
Key repeating ('repeat' and 'delay' config options) is not yet implemented/tested for N:N mappings. |
happy user of @pronobis fork. please consider a merge. thanks! ;-) |
I merged #16 which provides an equivalent capability in a different way, although it doesn't do anything like window mapping. That's beyond the scope of what I want this program to do. |
The problem I had with |
The problem is you have to wait for all keys pressed to decide whether or not to remap to a single. SO if you are remapping CTRL+X to "BKSPACE", everytime ctrl is pressed, evedevremapkeys will have to not send the ctrl code on until it sees the next key. So remapping CTRL+X to a single key delays the handling for all CTRL combos. This is true of all N to 1 mappings. |
Probably a bug in modifier group handling. My suspicion is if you have a modifier group for Ctrl-A, and you press Ctrl-B, it forgets to send on the original Ctrl code. The of "Modifiers" doesn't really exist at the event level, so I don't necessarily think this is the best implementation. What is seen is CTRL-pressed B pressed B released Ctrl-released. If we had a syntax for supporting A is pressed and then B is pressed vs A pressed B pressed B released A released, we could be a bit more flexible. Hmm. |
@pronobis "All additional keys are simply passed from the input to the output" is it possible to disable this feature? |
Is it possible to map, e.g. a combination of Ctrl and left arrow keys to the Home key?
If yes, how can I specify that in the YAML configuration?
The text was updated successfully, but these errors were encountered: