-
Notifications
You must be signed in to change notification settings - Fork 225
Description
Hello!
System info of relevance;
- keyd version: v2.5.0
- OS: Manjaro
- Kernal: 6.12.48-1-MANJARO (64-bit)
- Desktop env.: KDE Plasma v6.3.6, KDE framework v6.18.0
- graphics Platform: Wayland
The macro2 function appears to trigger the first macro execution immediately on key press rather than waiting for the timeout period to expire.
This leads to inconsistent timing behavior where the first run of the macro runs instantly, and the first repeat begins after the timeout, often overlapping or creating a stutter depending on macro duration.
The expected behavior is that macro2 should delay the first macro execution until after the timeout of the key being held, then repeat every <repeat_timeout> while the key remains pressed. An example of the expected logic is as follows;
on hold:
- wait (timeout)
- run macro
- after repeat timeout: start repeating every repeat timeout
Currently it behaves like;
on hold:
- run macro
- after timeout: start repeating every repeat timeout
This causes:
- An instant first macro (ignoring the hold delay).
- The first repeat firing ms after keypress (not after macro completion, or very quickly after first run).
- Overlap/stutter when the macro duration is near the timeout threshold.
This can be easily reproduced with the line;
A = macro2(600, 1000, macro(B 500ms C))
and monitored with keyd monitor
Observed sequence:
- On pressing A, "B > 500ms > C" occurs immediately.
- ~600 ms after the key stared to be held, the macro triggers again, causing a stutter in this case when the second run of the macro is but 100ms after the first.
- Further repeats continue every 1000ms as intended.
In a pure timeline based output of events since the key started to be held it would be as follows;
- 0000ms = B
- 0500ms = C
- 0600ms = B
- 1100ms = C
- 1600ms = B
- 2100ms = C
and so on. Note the second and third line.
since
What is expected is;
- 0600ms = B
- 1100ms = C
- 1600ms = B
- 2100ms = C
- 2600ms = B
- 3100ms = C
Setting both values equal (macro2(1000, 1000, ...)) makes it fire immediately, then repeat cleanly, confirming that affects only repeat scheduling.