Skip to content
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

Feature: key remapping #9

Open
geloescht opened this issue Sep 16, 2018 · 3 comments
Open

Feature: key remapping #9

geloescht opened this issue Sep 16, 2018 · 3 comments
Labels

Comments

@geloescht
Copy link

Thanks for netevent, it is a fantastic project and configuring it is a very pleasant experience compared to similar tools I have used. One thing that could come in handy would be the ability to remap keys on the fly before sending them over the network. Sometimes the keycodes mapped to hardware buttons make no sense on a remote host and it would be nice to avoid having to install yet another translation layer.

@Blub Blub added the feature label Sep 17, 2018
@Blub
Copy link
Owner

Blub commented Sep 17, 2018

No objection from me. Ideally the implementation would make this available in both daemon & create modes.
Also: scaling for relative axes could be added. (Then I wouldn't have to run xinput to set a scaling matrix for my desktop mouse on my laptop anymore... ;-) )
I'll look into this when I have the time (unless someone wants to beat me to it ;-) )

@Blub
Copy link
Owner

Blub commented Dec 2, 2018

So I'm wondering... should there be a simple key remapping made for now, or perhaps go the fully generic route and allow some kind of script? Like lua?
Something like

device set track-relative-axes on
transform add scalex {
    if event.key == EV.REL and event.code == 0 then
        event.value = event.value * -0.3
    endif
}
transform enable my-mouse scalex

vs something like

transform add some-name {
    # leaving out a field (it's 'type:code:value') is like a wild-card match:
    remap key:123 key:321
    # drop key-down on key 321
    remap key:321:1 drop
    # For swapping to work the 'match' side would have to always match on the original value...
    remap rel:0 rel:1
    remap rel:1 rel:0
    # For scaling see the comment below...
    scale rel:0 0.5
    # or some kind of matrix transformation: specify up to 3 input axes, a 3x3 matrix and up to 3 output axes... faces the same issues as commented below...
}
transform enable my-kbd some-name
transform enable my-mouse some-name

Also: scaling relative axes would probably be weird since some devices produce a lot of 1 values rather than few higher values. For this the InDevice class would have to keep track of relative axes with floating point values and only produce events when they exceed 1.0.

@geloescht
Copy link
Author

Both implementations would be fine for my purposes as long as they don't require external programs or complicate the compilation of netevent greatly (I use it on embedded).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants