Skip to content

Backspace latency #220

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

Closed
1 of 3 tasks
ekrenzin opened this issue Apr 12, 2021 · 6 comments
Closed
1 of 3 tasks

Backspace latency #220

ekrenzin opened this issue Apr 12, 2021 · 6 comments

Comments

@ekrenzin
Copy link

ekrenzin commented Apr 12, 2021

Version
Latest

Short overview
The backspace key has significant latency when triggered multiple consecutive times even when keyboard config delay is set low.

Issue occurs on

  • Virtual machine
  • Docker container
  • Dev/Host system

Detailed error description

The backspace key has significant latency when triggered multiple consecutive times even when keyboard config delay is set low. The backspace key appears to ignore the delay setting. After creating a queue of backspace key events, the code will freeze up and will continue pressing backspace for a while.

Steps to reproduce error
Press and release the backspace key multiple times rapidly. Can be recreated with for loops.

Additional content

Delay has been set to 1ms yet delay is still 300ms:
image

@ekrenzin
Copy link
Author

ekrenzin commented Apr 12, 2021

Just realized this is all keys. Only typing a string has decent performance. Any way to fix this?

@ekrenzin
Copy link
Author

Backspace can be typed faster than it can be triggered.

@s1hofmann
Copy link
Member

Hi @ekrenzin 👋

there’s a static delay on single keypresses (a leftover from robotjs, which I initially forked). I see no particular reason for it, so I might consider dropping it.

@ekrenzin
Copy link
Author

ekrenzin commented Apr 12, 2021

Hi @ekrenzin 👋

there’s a static delay on single keypresses (a leftover from robotjs, which I initially forked). I see no particular reason for it, so I might consider dropping it.

Hi @s1hofmann, thanks for the quick response, it's much appreciated!

Your explanation makes sense. I'd advocate for dropping it because it removes a lot of control from the developer. Also it was difficult to debug why some keys were more latent than others (after setting the config). Adding documentation regarding the delay would also help.
https://nut-tree.github.io/nut.js/classes/keyboard.html#presskey

In the meantime, can you point me in the direction of that delay so I can eliminate it on my own fork? Thanks so much!

@s1hofmann
Copy link
Member

There are two lines causing the delay in https://github.com/nut-tree/libnut

_keyTap

_keyToggle

Maybe you want to consider opening a PR?

@ekrenzin
Copy link
Author

Thanks!

I'd be happy to create a PR after/if I get it working and tested. Closing this issue, thanks again!

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

2 participants