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

Cancels held down key. #7

Open
xeon826 opened this issue Apr 10, 2024 · 3 comments
Open

Cancels held down key. #7

xeon826 opened this issue Apr 10, 2024 · 3 comments

Comments

@xeon826
Copy link

xeon826 commented Apr 10, 2024

Works great but if the key chatters on a stroke where you're holding down, it will be as if you're not holding the key down at all.

@finkrer
Copy link
Owner

finkrer commented Jul 22, 2024

Hi @xeon826. I can't confirm this myself as I'm not using Linux anymore, however, while holding the key, the keyboard emits different events compared to pressing the key. I am specifically not filtering key hold events at all.

Just to be clear, as far as I know, the "key is being held" state is tracked by the keyboard itself. Just because the key down was filtered by the PC doesn't mean there will be no key hold events later.

I am not sure of this, but it may be that your keyboard itself, because of its chattering issue, is detecting the key as not pressed and not sending the hold events.

In case the issue really is with the tool, you or anyone else are welcome to submit a pull request, which I'm not sure what it should do to be honest. In any case, I can't test the tool myself right now.

@CarlosRuiz-globalqss
Copy link

in my case holding the down key has a small lag, but I just keep it pressed and it works

my Keyboard: Logitech G413
OS: Linux Mint 21.3

@Cedric-Becks
Copy link

Cedric-Becks commented Dec 10, 2024

Had the same problem. To fix you have to replace the following lines in filtering.py

# some events we don't want to filter, like EV_LED for toggling NumLock and the like, and also key hold events
if not event.matches(libevdev.EV_KEY) or event.value > 1:

with this:

# filtering keys that are held down for combinations disable said combination from working (i.e. shift+d for D)
blacklist = event.matches(libevdev.EV_KEY.KEY_RIGHTALT) or\
        event.matches(libevdev.EV_KEY.KEY_LEFTALT) or\
        event.matches(libevdev.EV_KEY.KEY_RIGHTSHIFT) or\
        event.matches(libevdev.EV_KEY.KEY_LEFTSHIFT) or\
        event.matches(libevdev.EV_KEY.KEY_RIGHTCTRL) or\
        event.matches(libevdev.EV_KEY.KEY_LEFTCTRL)

# some events we don't want to filter, like EV_LED for toggling NumLock and the like, and also key hold events
if blacklist or not event.matches(libevdev.EV_KEY) or event.value > 1:

I tried to do a pull request but I am to tired to figure it out right now. Maybe tomorrow or later

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

No branches or pull requests

4 participants