xremap / xremap

Key remapper for X11 and Wayland
MIT License
1.54k stars 85 forks source link

Mouse remapping doesn't work #529

Open Ascyt opened 2 months ago

Ascyt commented 2 months ago

When I have something like:

keymap:
  - remap:
    BTN_RIGHT: Ctrl-v

where BTN_RIGHT is taken from https://github.com/emberian/evdev/blob/1d020f11b283b0648427a2844b6b980f1a268221/src/scancodes.rs#L26-L572 (as mentioned in the readme) and assumed to mean the right click mouse button.

It doesn't alter the behaviour of the right click button. This is the same for any other mouse buttons, including scroll wheel behaviour.

When I run it it does appear to detect the correct mouse:

Selecting devices from the following list:
------------------------------------------------------------------------------
/dev/input/event0 : Power Button
/dev/input/event1 : Lid Switch
/dev/input/event10: HD-Audio Generic Mic
/dev/input/event11: HD-Audio Generic Headphone
/dev/input/event12: Logitech G502 HERO Gaming Mouse
/dev/input/event13: Logitech G502 HERO Gaming Mouse Keyboard
/dev/input/event14: input-remapper keyboard
/dev/input/event2 : Video Bus
/dev/input/event3 : AT Translated Set 2 keyboard
/dev/input/event4 : Wireless hotkeys
/dev/input/event5 : PC Speaker
/dev/input/event6 : HP WMI hotkeys
/dev/input/event7 : ELAN071A:00 04F3:30FD Mouse
/dev/input/event8 : ELAN071A:00 04F3:30FD Touchpad
/dev/input/event9 : HD-Audio Generic HDMI/DP,pcm=3
------------------------------------------------------------------------------
Selected keyboards automatically since --device options weren't specified:
------------------------------------------------------------------------------
/dev/input/event13: Logitech G502 HERO Gaming Mouse Keyboard
/dev/input/event14: input-remapper keyboard
/dev/input/event3 : AT Translated Set 2 keyboard
------------------------------------------------------------------------------

where "Logitech G502 HERO Gaming Mouse" is indeed the mouse I have.

I don't get any error messages or similar when I start xremap or press right click. It just doesn't alter the behaviour of right click. Normal keyboard keys work fine. I am running xremap with sudo.

wistoft commented 2 months ago

Have you tried to start xremap with the argument --mouse. If that works, then I think the issue is the missing warning. Because xremap could warn, that you have mouse hotkey, but doesn't listen to mouse events.

vuongtuha commented 2 months ago

@wistoft for this case, could we make 1 main config runs for both mouse/keyboard? I mean normal I would start xremap on boot like this xremap $HOME/.config/xremap/config.xml --watch=device or I should point out --device={abc} for better usage?

Ascyt commented 2 months ago

Have you tried to start xremap with the argument --mouse. If that works, then I think the issue is the missing warning. Because xremap could warn, that you have mouse hotkey, but doesn't listen to mouse events.

With this argument, it is possible to detect and simulate mouse buttons, however the scroll wheel using SCROLLUP or SCROLLDOWN does not work.

It also has a weird side effect of making my laptop's touchpad pretty much cease to work - left and right clicking still works with it, but I'm unable to move my cursor with my touchpad. It does appear to get detected automatically and starting the program states /dev/input/event10: ELAN071A:00 04F3:30FD Touchpad, but yeah. That I would say is a different issue though, if you want I could create another issue talking about this

Also, yes, a warning like that does sound like a good idea

wistoft commented 2 months ago

With this argument, it is possible to detect and simulate mouse buttons, however the scroll wheel using SCROLLUP or SCROLLDOWN does not work.

The are two unfortunate keys SCROLLUP/SCROLLDOWN, which don't have effect. At least not for me. However, there are some 'pseudo keys', that xremap defines, which corresponds to mouse scroll:

keymap:
  - remap:
      ctrl-XUPSCROLL: pageup
      ctrl-XDOWNSCROLL: pagedown

These can only be used for matching input. They can't be used to emit scroll events. Which I think is something xremap could warn about, if a config has them as output.

It also has a weird side effect of making my laptop's touchpad pretty much cease to work

Yes, I think it's best with another issue, so it's easier for someone to look into it. But I'm not the maintainer though, so just my opinion.

wistoft commented 2 months ago

@vuongtuha

could we make 1 main config runs for both mouse/keyboard?

Yes, that's perfectly fine.

or I should point out --device={abc} for better usage?

I don't use --device, so I'm not sure. But if things work for you without --device, I would stick to it.