keyd: bug: strange macro behaviour
In order to properly understand the macro parsing algorithm, I started playing with it a bit. Specifically, I think that line 379 of docs/keyd.scdoc, which reads
- contiguous group of characters, each of which is a valid key code
and describes one of the valid space separated tokens accepted by macro() is a bit misleading, as, for groups consisting of more than one character, “key code” seems to only include their one character descriptions if available (such as ‘a’, ‘A’, ‘.’ but not ‘dot’ for the latter). In my opinion - given that I understood the functionality correctly, “key code” should be changed to “one character key name (all recognized key names can be printed by keyd --list) except ’ ', such as ‘a’, ‘A’, ‘.’ but not ‘dot’”.
While testing, I encountered the following strange behaviour: With keyd config only including
[ids]
<some_valid_id>
[main]
a = macro(semicolonspaceworld)
repeatedly tapping a in a shell, sometimes no text is entered at all after an individual press and sometimes semicolonspaceworld is entered correctly. The frequency with which a inserts nothing seems to be random and independent of the speed with which one presses the key in succession. I had up to eight presses in a row without any effect. The problem seems to be that the string inside macro() contains long forms of valid key codes, as the bug is gone with a = macro(test).
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (12 by maintainers)
Commits related to this issue
- Add macro_sequence_timeout (#255) — committed to rvaiya/keyd by rvaiya 2 years ago
(Is there a way to donate to you for this fantastic program I wish I’ve had for my last 25+ years on Linux?)
From distribution:
Self compiled:
OS: Alpine Linux Edge (Linux 5.19.0-rc7) on a Dell Inspiron 7620 (12th gen Core i7 1260P, 32GB RAM, very fast SSD) (BTW, my statically compiled binary works great on ChromeOS too!)
DE: KDE 5.25.3.1 / Wayland / libinput
The issue is somewhat random. Occasionally the whole macro is output correctly but usually only part of the macro is output or nothing at all (see below).
The issue occurs in (at least) Konsole 22.04.3, gnome-terminal 3.44.0, xfce4-terminal 1.0.4 and xterm 372. The issue occurs in other GUI applications as well, including (at least) gedit 42.1, Firefox 102.0.1 and Chromium 103.0.5060.114. The issue does not occur in the Linux virtual console. (At least it doesn’t occur with the relatively short macros I’ve tested.) The issue does not occur for macros of 15 or fewer characters. These are always output correctly for me.
Config:
My guess is the culprit might be libinput or maybe Wayland.
Yes, my stupid rookie mistake …
After upgraded to
2.4.3,macro_sequence_timeout=10000works ! (except when I unreasonably quickly continuously emit)(sorry for my mistake and this late reply …
Thanks for addressing this issue. The problem completely disappeared for me using a value of one.