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

Keyboard and mouse combo remap #14

Open
Ashark opened this issue Jun 20, 2022 · 2 comments
Open

Keyboard and mouse combo remap #14

Ashark opened this issue Jun 20, 2022 · 2 comments

Comments

@Ashark
Copy link

Ashark commented Jun 20, 2022

There is imwheel tool for X11, that allows you to remap mouse wheel events combined with keyboard modifiers. I am looking for this functionality on wayland.

The problem is that afaik, this tool (evremap) currently only allow you to map a single device, while thing that I want requires two devices.

This works (remaps mouse button):

device_name = "Logitech MX Master"

[[remap]]
input = ["BTN_RIGHT"]
output = ["KEY_PAGEUP"]

This also works (remaps keyboard combination):

device_name = "Logitech K850"

[[remap]]
input = ["KEY_LEFTALT", "KEY_UP"]
output = ["KEY_PAGEUP"]

But such thing does not work:

device_name = ["Logitech MX Master", "Logitech K850"]

[[remap]]
input = ["KEY_LEFTALT", "BTN_RIGHT"]
output = ["KEY_PAGEUP"]

because device_name is expected to be a string.
Can we hope such functionality will be implemented?

@Ashark
Copy link
Author

Ashark commented Jun 22, 2022

I was able to merge keyboard and mouse to a single virtual device, which allowed this remap:

device_name = "virtual merged device"

[[remap]]
input = ["KEY_LEFTALT", "BTN_RIGHT"]
output = ["KEY_PAGEUP"]

But the problem now seems to be in specifying a mouse wheel event instead of button in the config. Is something like this possible?

device_name = "virtual merged device"

[[remap]]
input = ["KEY_LEFTALT", "REL_WHEEL"]
output = ["KEY_LEFTCTRL", "REL_WHEEL"]

The utility needs to handle that REL_WHEEL somehow. It is not in evremap list-keys apparently.

@wez
Copy link
Owner

wez commented Jun 22, 2022

It's been a while since I looked at this...

https://github.com/wez/evremap/blob/master/src/mapping.rs#L53 uses KeyCode for its type, which is an alias for https://docs.rs/evdev-rs/latest/evdev_rs/enums/enum.EV_KEY.html

If the evremap code were to target https://docs.rs/evdev-rs/latest/evdev_rs/enums/enum.EventCode.html instead of the alias, then it would be possible to match any event.

A lot of the code assumes EV_KEY so it's not a trivial one-line change, but I think a lot of the changes would be fairly mechanical in nature.

I don't have time to look at this myself, but I'd be open to seeing a PR that extends evremap in this way!

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

Successfully merging a pull request may close this issue.

2 participants