KarsMulder / evsieve

A utility for mapping events from Linux event devices.
GNU General Public License v2.0
222 stars 12 forks source link

Inconsistent behaviour with `--hook` and `--withhold` with repeated presses #46

Open masnax opened 2 months ago

masnax commented 2 months ago

Take the following configuration:

evsieve \
--input /dev/input/event9 grab domain=k1 \
--hook key:leftmeta key:m sequential breaks-on=key::1 send-key=key:leftctrl send-key=key:o exec-shell="echo something" \
--withhold \
--output @k1

Which is intended to passthrough all inputs to @k1 except leftmeta+m, which will instead send leftctrl+o, and execute a script.

However, if leftmeta is held down while m is pressed and unpressed repeatedly, the --withhold seems to no longer work properly:

# Press "leftmeta", then "m"
KeyPress    keycode 37   Control_L
KeyPress    keycode 32   o

# Release only "m"
KeyRelease  keycode 32   o
KeyRelease  keycode 37   Control_L

# Press "m" again, with "leftmeta" held down.
KeyPress    keycode 58   m  <-- should not be sent
KeyPress    keycode 37   Control_L
KeyPress    keycode 32   o

# Release only "m"
KeyRelease  keycode 32   o
KeyRelease  keycode 37   Control_L
KeyRelease  keycode 58   m <-- should not be sent
KarsMulder commented 2 months ago

Thanks for the bug report!

The good news is that I have managed to reproduce the bug and have figured out what causes it. The bad news it that it isn't easy to fix and requires me to completely rethink how --withhold works.

I'm currently working on a solution.

KarsMulder commented 2 months ago

This issue is now most likely fixed on the main branch.

I'm going to skip making a 1.4.1 patch and will instead try to officially release version 1.5.0 somewhere in the next couple of weeks.