sezanzeb / input-remapper

๐ŸŽฎ โŒจ An easy to use tool to change the behaviour of your input devices.
GNU General Public License v3.0
3.72k stars 153 forks source link

Input not suppressed #579

Open Hackgets opened 1 year ago

Hackgets commented 1 year ago

I created a macro modify(Shift_L, wheel(down, 50)) when right click and wheel input to change the scroll direction horizontally, but it is not suppressing the right click input and it is frustrating that the menu is displayed.

Information:

  1. input-remapper 1.5.0 e31a1b2bc5d23fe13130afcc242063196335399f https://github.com/sezanzeb/input-remapper python-evdev 1.3.0

  2. Zorin OS 16.2 x86_64

  3. x11

  4. Gnome

  5. lrwxrwxrwx 1 root root 0 12ๆœˆ 17 15:51 /proc/1/exe -> /usr/lib/systemd/systemd

  6. {
    "mapping": {
        "1,272,1+1,275,1": [
            "KEY_PLAYPAUSE",
            "keyboard"
        ],
        "1,272,1+1,274,1": [
            "Alt_L + Super_L + 8",
            "keyboard"
        ],
        "1,273,1+2,8,-1": [
            "modify(Shift_L, wheel(down, 50))",
            "keyboard + mouse"
        ]
    }
    }
17:44:55.825166 20397 Service DEBUG keycode_mapper.py:522: maps to macro (modify(Shift_L,wheel(down,50)), keyboard + mouse) ((1, 273, 1), (2, 8, -1))
17:44:55.825567 20397 Service DEBUG keycode_mapper.py:322: Macro sending (1, 42, 1) to keyboard + mouse
17:44:55.836298 20397 Service DEBUG keycode_mapper.py:322: Macro sending (2, 8, -1) to keyboard + mouse
17:44:55.856170 20397 Service DEBUG keycode_mapper.py:495: duplicate key down ยทยทยทยทยทยทยทยทยทยทยทยท ((1, 273, 1), (2, 8, -1))
17:44:55.857782 20397 Service DEBUG keycode_mapper.py:322: Macro sending (2, 8, -1) to keyboard + mouse
17:44:55.878811 20397 Service DEBUG keycode_mapper.py:322: Macro sending (2, 8, -1) to keyboard + mouse
17:44:55.900330 20397 Service DEBUG keycode_mapper.py:322: Macro sending (2, 8, -1) to keyboard + mouse
17:44:55.921284 20397 Service DEBUG keycode_mapper.py:322: Macro sending (2, 8, -1) to keyboard + mouse
17:44:55.942576 20397 Service DEBUG keycode_mapper.py:322: Macro sending (2, 8, -1) to keyboard + mouse
17:44:55.963607 20397 Service DEBUG keycode_mapper.py:322: Macro sending (2, 8, -1) to keyboard + mouse
17:44:55.985660 20397 Service DEBUG keycode_mapper.py:322: Macro sending (2, 8, -1) to keyboard + mouse
17:44:55.992467 20397 Service DEBUG keycode_mapper.py:437: releasing macro ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ((2, 8, 0))
17:44:55.992655 20397 Service DEBUG keycode_mapper.py:450: releasing key ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท ((2, 8, 0))
  1. Command not found
jonasBoss commented 1 year ago

your best bet is to switch to the beta branch. There it is possible to map one axis to another without macros.

But this will not solve the issue with the right mouse click. In fact that can not really be solved because the right mouse click happens before you move the wheel, an therefore the combination did not trigger yet.

You want two mappings for that the first one maps the combination of button right + Wheel to the mouse REL_HWEEL and the second one disables button right + Wheel HI RES otherwise the HI RES events might cause a diagonal scrolling motion.

[
    {
        "input_combination": [
            {
                "type": 1,
                "code": 273
            },
            {
                "type": 2,
                "code": 8
            }
        ],
        "target_uinput": "mouse",
        "output_type": 2,
        "output_code": 6,
        "mapping_type": "analog",
        "deadzone": 0.0
    },
    {
        "input_combination": [
            {
                "type": 1,
                "code": 273
            },
            {
                "type": 2,
                "code": 11
            }
        ],
        "target_uinput": "keyboard",
        "output_symbol": "disable",
        "mapping_type": "key_macro"
    }
]

image image

Hackgets commented 1 year ago

Some web browsers support rocker gestures, but when I try to do that with Input Remapper, I get the same problem of the second click not being suppressed. I hope this issue can be resolved.

jonasBoss commented 1 year ago

that would require us to change how combinations work.

A possible solution could be the introduction of a greedy parameter for the InputCombination class. The key-down event would be not forwarded until the key-up event arrives, and only if the combination was not triggered. This will have some side-effects: the button would be only injected once the button is released. And holding the button down will be impossible.

When implementing such a change it is also required to think about what happens when multiple combinations overlap and when greedy and non greedy combinations overlap.