Closed kbilsted closed 1 month ago
Perhaps an alias with params could work better?
example?
gives some really weird results
Indeed, but it works as expected.
When you press any key it is not output because it waits whether a Y
follows or not.
If you press Y
then the previously entered key is output twice.
But if you press some other key then it can no longer match Any Y
and the previous key is output and the new key waits until Y
is pressed or not.
Do you have by any chance a QWERTZ keyboard and mixed up the Y and Z keys? That's what I did at first.
i think for this to be usable I need to use parameters and exclude modifiers
what is really needed is a notion of a keybuffer, so that when you press a key it is sent to the screen, then when the magic button is pressed, it will then output the next character, this makes you type less in the blind.. If you want the magic key to replace the output it has to send backspace characters in order to replace content...
but i realize that having a char buffer is radically different to the functional approach so probably this idea is too far off.. I know other keymappers having support for this, e.g. kanata, but I was frustrated with how they handled ALT keys
@kbilsted Espanso which I've recommended earlier to check out could possibly be more suitable for this. It is specifically for typed string replacement and supports regex patterns and capture groups. So it can do the backspacing required for this.
I've been thinking about how to solve a bit related need. I'd like to do Vim style leader key mappings but also find it problematic doing it blind as you can't be sure if the initial trigger sequence has gotten registered (or typed correctly).
The vague plan I've been thinking about would involve triggering a virtual key to temporarily enter a different "mode". I would then have an external script waiting for the virtual key to be pressed and then output e.g. the list of valid following keys on the window manager taskbar. Involving a virtual key as a mode would also allow a cleaner config as I could have the follow up keys declared in a separate context block. I haven't yet experimented with the idea though so not sure if this will work or not. :)
I have to say though that your plan of having Any Y
as the trigger sounds like it would create a noticeable lag for each typed key? I've generally been avoiding to have any common alphas even as the first key in the trigger sequence as it inevitably makes the typed text output in a "staggered" way. Doesn't this bother you? 🤔
With something like Espanso this would not be the case though as it allows the keys to be typed normally and then acts based on that. But I'm not sure if using it in this manner would just end up with your following characters getting mixed up with what Espanso types after it detects the matching sequence. I haven't tried using any type of wildcard as the initial key in a sequence either.
@ristomatti thanks for all the ideas! I think espanso is not the way forward. just looked at it again.. you idea of another mode sounds cool! I also was thinking about similar ideas.. also with an idea of having an overlay display the keyboard and light up the keypresses.. this will make it much easier learning a new keyboard layout... I haven't been able to find a keyboard overlay .. but search engines are really difficult to get good results from at the moment it seems
@kbilsted You mean something like https://alternativeto.net/software/screenkey/
Thanks but i wish for a whole keyboard being displayed:)
I gave up and made one myself .. muuuuch easier than i thought ;)
@houmain do you think that there could be a notion of a "char buffer" that can be used in as output
then one can define
Any Y >> BUFFER[0]
At least to me that sounds like going too deep in the technical details compared to the other features. I'm not for or against the end result you are after, but the example syntax you suggest would make quite an unexpected special case since it could as well mean calling something like this:
BUFFER = 'Hello ' $0
Any Y >> BUFFER[0] # When pressing any key followed by Y, the output would be: Hello 0
semantics over syntax. The importance is a notion of a buffer of the last N typed characters
eg
Any Y >> Buffer<0>
or
Any Y >> Buffer.Get(0)
what is really needed is a notion of a keybuffer, so that when you press a key it is sent to the screen, then when the magic button is pressed, it will then output the next character, this makes you type less in the blind.. If you want the magic key to replace the output it has to send backspace characters in order to replace content...
This sounds more to me like you are after a new feature on the input side. So the keys are not hold back but can still participate in the input matching, right? Something like:
X? Y >> Backspace Z # the ? is the new syntax
X >> W
X
would immediately output W
and not wait for the potentially following Y
,
then if a Y
follows it would trigger the first mapping, delete the W
and output Z
.
Well there are a few variations on what an adaptive key is.
To some it is a repeat of the previous key.
To others it is a way to reduce Same-finger-bigram
Others again use it to make typing more efficient by autocompleting several characters such as T
Y
>> "the" and T
F
Y
>> "therefore" etc
and yes, keys are not held back and may thus require the use of backspace
Are the other your referring to implementing this on QMK (or some other firmware) or another keymapping tool run on the computer?
I am trying to define a repeat key on Y that repeats the last pressed key
gives some really weird results