keyd icon indicating copy to clipboard operation
keyd copied to clipboard

[feature request] magic key/repeat key

Open throwaway-nolsh opened this issue 1 year ago • 2 comments

hi, ive been using keyd for like 2 days now and ive got basically my whole qmk keyboard setup running all on my laptop keyboard which is pretty sick

that being said, from what i read, i do miss one feature from qmk and it would be cool if it could be implemented: the magic key/repeat/alternate repeat key

basically it repeats whatever letter was last typed, so 'dd' would become 'd[repeat]' you can also specify that after typing a letter, a different one shall be repeated, so 'ar' (which is hard for me to type on colemak) would become 'a[repeat]'

thank you :)

throwaway-nolsh avatar Sep 26 '24 06:09 throwaway-nolsh

This sounds like a cool feature!

I do want to note that it is somewhat possible already with the oneshotm action. There will be a lot of duplication and drawbacks such as the loss of repeat-by-holding, which is why a dedicated feature would be nice, but still, if you're really missing it:

[main]
a = oneshotm(repeata, a)
b = oneshotm(repeatb, b)
# etcetera

[repeata]
. = a

[repeatb]
. = b

# etcetera

nsbgn avatar Oct 01 '24 20:10 nsbgn

thank you for providing a way to do what i was looking for - will try this now, although as you said its kinda impractical to do for every key if you just want a normal repeat key

throwaway-nolsh avatar Oct 03 '24 20:10 throwaway-nolsh

I would also love to have this feature

oiiiiiiii avatar Jul 15 '25 09:07 oiiiiiiii

The problem with the workaround is that keyd can only handle a certain amount of layers. If I add to many that way this assertion fails and keyd crashes

oiiiiiiii avatar Jul 20 '25 15:07 oiiiiiiii

This has been been implemented on master in the form of repeat(). It also works with compound sequences (C-x) and macros. Let me know how you get along with it.

rvaiya avatar Aug 09 '25 23:08 rvaiya

But repeat would not allow to define a more general magic key, would it? Like a *mag* -> ab but c *mag* -> cd

Only a *mag* -> aa and c *mag* -> cc right? Or am I missing something?

oiiiiiiii avatar Aug 12 '25 14:08 oiiiiiiii

Yes, repeat() will only repeat the last sequence. If you want a pair of keys to produce an arbitrary sequence then a layer is the appropriate tool, as mentioned by @nsbgn.

rvaiya avatar Aug 12 '25 17:08 rvaiya

Yes, the problem is just that you quickly run out of layers with that method as I mentioned above and also that you can no longer hold the keys, which is sometimes useful (e.g. to undo all changes when holding u in vim). But the max number of layers can be increased quite easily when building from source. Thanks a lot for your awesome work ❤️

oiiiiiiii avatar Aug 12 '25 19:08 oiiiiiiii

Actually one more question: Is it intended that when I bind a = oneshotm(repeata, a) as suggested above only one 'a' get printed when I hold the a key?

oiiiiiiii avatar Aug 16 '25 15:08 oiiiiiiii

love this feature, but when doing sequences like xxyy there is an issue where pressing a new key while the repeat key is held does not update the register for subsequent presses of the repeat key, producing xxyx instead. This occurs in words like "coffee", "woollen", "bookkeeper", etc when typing at speed. If this is an intended behaviour, I'd love an additional command repeatd() which repeats the last keydown.

Perplexedon avatar Aug 28 '25 09:08 Perplexedon

when doing sequences like xxyy there is an issue where pressing a new key while the repeat key is held does not update the register for subsequent presses of the repeat key, producing xxyx instead.

This is indeed a bug and should be fixed in the latest commit.

the problem is just that you quickly run out of layers

Most users aren't going to manually remap a large number of keys like this and, as you've observed the limit can be manually be tweaked if necessary.

and also that you can no longer hold the keys

This is now possible using overloadk() as proposed in #1095.

I'm tentatively closing this, but feel free to comment/reopen it if you encounter any issues.

rvaiya avatar Sep 11 '25 05:09 rvaiya