Skip to content
This repository has been archived by the owner on Apr 12, 2020. It is now read-only.

Some way to detect repeating? #8

Closed
seletskiy opened this issue Aug 19, 2015 · 4 comments
Closed

Some way to detect repeating? #8

seletskiy opened this issue Aug 19, 2015 · 4 comments

Comments

@seletskiy
Copy link
Contributor

I want to make it possible for screenkey to act as key logger for analyzing my productivity. But it looks like python-xlib is lacking of required sequence_number field in XKeyEvent structure, which is required to detect key repeating. I have decent repeat rate/delay (140/100), so I do not want to pollute history of logged keys.

Do you have any ideas how to achieve that?

@wavexx
Copy link
Owner

wavexx commented Aug 19, 2015

On 19/08/15 14:54, Stanislav Seletskiy wrote:

I want to make it possible for screenkey to act as key logger for
/analyzing my productivity/. But it looks like python-xlib is lacking of
required sequence_number field in XKeyEvent structure, which is required
to detect key repeating. I have decent repeat rate/delay (140/100), so I
do not want to pollute history of logged keys.

Do you have any ideas how to achieve that?

I had to ditch python-xlib, since it didn't really allow to use XKB.

If all you need is the sequence number, it's already in there.
In keylistener.py:247 the event you (as long as is a
KeyPress/KeyRelease) contains ev.xkey.serial.

You could call XkbSetDetectableAutoRepeat so that KeyRelease is never
generated until the key is truly removed.

You can also detect a repeat by checking a release followed by a repeat
with the same ev.xkey.time, which wouldn't need to call
XkbSetDetectableAutoRepeat.

keylistener.py contains a self-test at the bottom when run stand-alone.

@wavexx
Copy link
Owner

wavexx commented Aug 19, 2015

I pushed some code to detect key repeat. I think it could be useful (maybe) to show the repeat in a different way.

I tried to change the color of the text to grey for repeats, but I find it distracting.
In any case, if you try keylistener, there's a new field "repeated" which you can use.

@seletskiy
Copy link
Contributor Author

@wavexx: Wow, thank you! Get ready to accept new PR 😄

@wavexx
Copy link
Owner

wavexx commented Sep 6, 2015

I guess we can close this

@wavexx wavexx closed this as completed Sep 6, 2015
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants