-
Notifications
You must be signed in to change notification settings - Fork 155
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
space on release if not part of combination + input lags #49
Comments
@sezanzeb thank you for answer |
ah I see. Mapping key-up wouldn't work because of the usage of is_key_down throughout https://github.com/sezanzeb/key-mapper/blob/main/keymapper/injection/keycode_mapper.py, but a macro can do it. It is however not possible to prevent the output of that macro if another key was pressed. |
Writing keys on release is Maybe via a macro on the combination that takes the triggering key for the mentioned macro as parameter in order to call stop (stop also doesn't exist yet) on it. e.g.
or maybe as a shorthand that implies an event type of ev_key and a value of 1 and that looks up the code in xmodmap
|
I think the solution would be something like this.
|
just sending the release event without prior down will not write that key. That means e.g. that if a combination of shift+a is mapped and shift also has a function in a game, shift would not do anything anymore. And even if you also inject the down event based on some condition after releasing, the shift would come late whereas people usually want fast reaction times. Feel free to try to implement a solution that passes all existing tests. But there are too many open questions and difficulties (how to configure, how to avoid the above problems, keycode_mapper is already quite complex) and it is an uncommon use case, so macros are the only way I would implement this. |
@sezanzeb Thank you for pointing me into the right direction. Here is my solution |
I guess plugin support would be cool. But I'm not sure yet about the security implications. Since the daemon is running as root it should only accept plugins that are owned by root, i.e. installed system wide via e.g. And I need to think of a proper way to configure which plugins should be used |
with the latest changes this is possible:
does that work for you? |
@sezanzeb wow! great! that works! I'm just pressing Ctrl+Left, Shift+Right (holding) or Ctrl+Left, Right (holding). simplescreenrecorder-2021-04-26_20.57.12-converted.mp4And that is mine script: simplescreenrecorder-2021-04-26_21.02.07-converted.mp4Also your mapping looks a bit hacky -)
Maybe add a full length command names? something like this:
Seems like you are creating your own language, just like |
The editor space is just so constrained, key-mapper would probably need a popup with a multiline text editor when editing macros. That is the only reason why I kept the names so short. I guess nothing is really lost, I can always add longer names at a later point. Creating a new language for that turned out to be an easy solution actually since it doesn't really need much. It was also fun to make. Could you please share the preset.json file? It's somewhere in
|
preset.json
evtest for mapped device
evtest for "forwarded" for same key combinations
I'm using Colemak keyboard layout, same for Hope that helps. |
can't reproduce on both X11/manjaro/xfce4 and wayland/ubuntu/gnome installations
you mean
|
correct
Don't know, same for me. Maybe I'm doing something wrong.
please explain, how not to forward? I've noticed that when I press "space" key, then all the keyboard input freezes (or caches) for about 1 second and only then appeared on screen. Even when I just typing and using "space" as a usual space between words.
Ubuntu 20.10, 64-bit, GNOME 3.38.3, X11, Intel® Core™ i7-3820 CPU @ 3.60GHz × 8, 16GB RAM |
https://github.com/LexRiver/linux-deep-hotkeys/blob/main/linux-deep-hotkeys.py#L150 if event.value == 2:
continue
My service remained below 1% cpu as far as I remember from yesterday The event seems to reach your environment and then, for whatever reason, it goes crazy and does nothing for a second. |
Well, I've tried your code, I've record for you a video with two simplescreenrecorder-2021-04-29_14.30.35.mp4 |
The timestamps look correct though. There is a 10 - 30ms gap between each event, even between those that appear after the lag. That means that python-evdev is apparently trying to write the event at the correct time.
|
|
Thanks. I upgraded to ubuntu 21.04 previously, but I'll try to make my other versions match yours as close as possible later and then try to reproduce it again. I'll also fork your script and write syn manually instead of forwarding it, maybe that makes the difference. |
pushed something to my fork of your script: https://github.com/sezanzeb/linux-deep-hotkeys please try it and report if it also lags now |
@sezanzeb I've tried your fork and it's not lagging. |
the fork is also injecting its own syn events, not just checking the value of 2 |
getting my versions to match yours won't work for me after the hirsute upgrade. Too much stuff depending on new versions kernel 5.8 works for me, no lags. my libevdev2 version is 1.11.0, but I don't know if that is relevant at all. I also never had any lags on groovy @whot if you have time, do you know what could cause lags like that? Here is a video: #49 (comment) Since the timestamps are correct I guess there must be something beyond key-mapper that has some sort of problem |
btw
and this is not:
also maybe the bug is somehow connected with the following two device parameters:
And you are creating two devices and I'm just one, maybe that should be checked also. |
Could you please generate some injection debug output? Your second config is not lagging because the lag must be somehow connected to events that are written to evdev/whatever. Does it also lag if you use a regular simple mapping instead of a macro? You could for example map space to space, which would cause space to be written via the second uinput. I'll modify your script later to use two uinputs similar to key-mapper. |
Please watch video simplescreenrecorder-2021-05-02_18.17.46.mp4
Yes, I'm confirming.
So bug appears on |
X/Wayland do their own key repeat, the kernel key repeats are filtered in libinput and would only affect a VT. Beyond that, no idea sorry, I'm too flat out to look at the key-mapper source and how it works. There's nothing that I'm aware of that handles space in a specific manner, at least not until you get to the toolkits that have to do the actual rendering. |
In a nutshell:
I guess it's not connected to space but rather to injecting anything at all. @LexRiver maybe, depending on how much time you have, you can already try to modify your script to work this way? And does it also lag when not using space but some random other key?
I understand that, thanks for the info with the repeat events though, very interesting. |
Solution 1Since april there are
Solution 2wait until #183 is released and then do
|
This has been released a long time ago. I'll close this therefore |
Hello, I want to bind
Space+J=Left
Space+K=Down
Space+L=Right
Space+I=Up
but
Space=Space
So If I just press down Space and release it, it will send normal Spacebar key " " as expected.
Is it possible with your tool?
The text was updated successfully, but these errors were encountered: