There are some applications that use strange/inconvenient user interaction and that is impossible to edit. I want to remap a combination of a keyboard and mouse event to another combination of keyboard and mouse event.

To be precise, I want such map ctrl + wheel up -> alt + wheel up to be activated when a specified application (davinci resolve) is in focus.

There is imwheel utility that solves exactly this task. But that utility is very outdated and targeted for X11, while I am looking for a solution for Wayland. As additonlal note, despite my current use case allows to use it (because davinci resolve currently only runs via Xwayland), it is working not so great. Sometimes several events are not "translated", which leads to unwanted effects. I hope the new wayland supporting utilities will not have such problem.

I have found a very similar question, but for two mice, and it had not exact answer.

I have found utilities (pronobis fork of evdevremapkeys or evremap) that potentially can serve this task, as they allow N:N mappings. But the config file for them uses only one device (at the moment of writing at least), see here.

Now I got an idea to create a virtual evdev input device from my keyboard and mouse (in other words, merge them), and use it in the utility's config. Is it possible?

I have a strong feeling that it may be possible with python-evdev or evsieve. But I do not know what exactly should I do to make such virtual input device.

  • I read as part of the link you provided "see here" that you found imwheel that would functionally answer your need (as far as I understand it, it actually would) but that you are in search of a solution compatible with a wayland backend. If my reading is correct (in short that in fact you are searching a wayland compatible imwheel), could you be explicit about that in your question here please.
    – MC68020
    Jun 21 at 4:15
  • Instead of creating a virtual device, you might find that Input Remapper allows you to do what you want. Jun 21 at 4:19
  • @StephenKitt I saw Input Remapper, but I could not find a way to map multi-device event. Maybe I am missing it. Can you show how to do it?
    – Ashark
    Jun 21 at 16:23
  • I wasn’t sure, thanks for giving it a shot! I see you found a nice solution. Jun 21 at 16:52
  • @StephenKitt It is half-solution, I now need to map exactly wheel event. Buy the way, Input Remapper does not list that "Evsieve Virtual Device" for some reason.
    – Ashark
    Jun 21 at 16:58

1 Answer 1


I have successfully created a merged device with the following command (with help of documentation):

$ evsieve --input /dev/input/event8 grab --input /dev/input/event5 grab --output

Where /dev/input/event8 is my keyboard, /dev/input/event5 is my mouse. And that created /dev/input/event3 with name Evsieve Virtual Device.

For the actual remap ctrl + wheel to alt + wheel and alt + wheel to ctrl + wheel we can change the command to the following (taken from here):

sudo evsieve --input /dev/input/event8 grab --input /dev/input/event5 grab \
    --hook   key:leftalt:1 toggle=alt:2 \
    --hook   key:leftalt:0 toggle=alt:1 \
    --hook   key:leftctrl:1 toggle=ctrl:2 \
    --hook   key:leftctrl:0 toggle=ctrl:1 \
    --toggle rel:wheel @alt-up @alt-down id=alt \
    --map    yield rel:wheel@alt-down key:leftalt:0 key:leftctrl:1 key:leftctrl:2 rel:wheel key:leftctrl:0 key:leftalt:1 \
    --toggle rel:wheel @ctrl-up @ctrl-down id=ctrl \
    --map    yield rel:wheel@ctrl-down key:leftctrl:0 key:leftalt:1 key:leftalt:2 rel:wheel key:leftalt:0 key:leftctrl:1 \
    --block  rel:wheel_hi_res \
    --print  @alt-down @alt-up @ctrl-down @ctrl-up \
    --output create-link=/dev/input/by-id/merged-virtual-KM name="merged virtual KM"

If want to use evremap, we can use the following config:

device_name = "Evsieve Virtual Device"

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

Pressing Alt + right mouse button moved my cursor up, i.e. generated PgUp. But mapping a wheel event is currently impossible.

  • 1
    Superb ! Congrats !
    – MC68020
    Jun 21 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.