keyd icon indicating copy to clipboard operation
keyd copied to clipboard

Can you press and release a key repeatedly?

Open toimine opened this issue 1 year ago • 2 comments

I'm trying to replicate this script I had in AutoHotkey that did this to Z if you held LCtrl (I need it to avoid mashing the button in some games) image I've tried reading the manual, but apart from macros (?), I found nothing that would let me hold keys, or make them be held or released (maybe I overlooked something). I'm asking because games would ignore a lot of presses without actually holding the key for a while, as I've discovered with another key remapper.

toimine avatar Jun 25 '24 16:06 toimine

No, I don't think that is currently possible. Would a global option to set the time between keydown/keyup of keypresses in a macro be sufficient for your use case?

(For future reference, this sounds like a problem similar to #732)

nsbgn avatar Jun 25 '24 20:06 nsbgn

Ideally it would be nice to set separate lengths for key down and key up, but one time setting is okay too

toimine avatar Jun 26 '24 06:06 toimine

It's not clear how this differs from the behaviour of macro2. What is wrong with something like leftcontrol = macro2(50, 100, z)?

rvaiya avatar Jan 12 '25 08:01 rvaiya

I'm tentatively closing this to reduce noise in the issue tracker, but feel free to reopen it if I have misunderstood something.

rvaiya avatar Jan 12 '25 19:01 rvaiya

It's not clear how this differs from the behaviour of macro2. What is wrong with something like leftcontrol = macro2(50, 100, z)?

This line makes the key get pressed and released instantaneously, so the presses barely get registered by the game. What I'm looking for is setting up the whole cycle of the key getting pressed, held for some time, and released, can keyd do that? I haven't checked the docs in ages, but iirc I couldn't find anything like that.

toimine avatar Jan 14 '25 15:01 toimine

You can do something like this leftcontrol = macro(z+300ms 300ms z+300ms 300ms z+300ms).

It is also theoretically possible to do this leftcontrol = macro2(100, 300, macro(z+300ms)) for an infinite repeat, but there is currently a bug which prevents this from working (patch pending).

rvaiya avatar Jan 17 '25 00:01 rvaiya