keyd icon indicating copy to clipboard operation
keyd copied to clipboard

[Question] Best way to handle accent ?

Open barcell1 opened this issue 1 year ago • 8 comments

Is using overload like the code below the best way to handle compose keys with accent ? like [+a will become á

[ids]
*

[main]


[ = overload(agudo,[)

[agudo]
a = á
e = é
i = í
o = ó
u = ú


[agudo+shift]
a = Á
e = É
i = Í
o = Ó
u = Ú

Thanks in advance !

barcell1 avatar Oct 08 '24 23:10 barcell1

To be clear, are you asking help on making this work or are you just asking about the 'best' way?

Because there isn't one. I personally prefer manually using the compose key to make accented keys (ie compose ' e for é), but that is because I typically write in languages that use accented symbols sparingly. Do what works for you. What you showed sounds reasonable.

nsbgn avatar Oct 10 '24 10:10 nsbgn

are you just asking about the 'best' way

This ! Thanks for your answer, im starting using this plugin, and my language is very common using accented keys. I just feel that the way i made here, i need to make the move kinda fast to work the combination, sometimes i miss, hence the question. But so far i found a very good tool !

Congrats for your work, is helping me a lot in the keyboard that im using, kinda hard to find decent keyboards in native language with a reasoanable price, so i use a US one and need some adaptations.

barcell1 avatar Oct 11 '24 01:10 barcell1

To be clear, are you asking help on making this work or are you just asking about the 'best' way?

Because there isn't one. I personally prefer manually using the compose key to make accented keys (ie compose ' e for é), but that is because I typically write in languages that use accented symbols sparingly. Do what works for you. What you showed sounds reasonable.

is possible to make a little longer (the overload to wait next key to see if accent will enter) in that way that i did ?

barcell1 avatar Oct 13 '24 15:10 barcell1

i need to make the move kinda fast to work the combination

What do you mean? As long as you are holding [, the combination should stay active.

is possible to make a little longer (the overload to wait next key to see if accent will enter) in that way that i did ?

What is the exact behaviour you're looking for in terms of keydown/keyup events?

I would otherwise suggest to use <[ down> <a down> <[ up> <a up> for á and <[ down> <[ up> <a down> <a up> for [a.

From what you've told me, I'm assuming that you want to be able to do <[ down> <[ up> (some short time) <a down> <a up> to get á, but <[ down> <[ up> (some longer time) <a down> <a up> to get [a. Is that correct?

nsbgn avatar Oct 13 '24 16:10 nsbgn

From what you've told me, I'm assuming that you want to be able to do <[ down> <[ up> (some short time) <a down> <a up> to get á

I just want to extend a little that time, to get the á. So would be: <[ down> <[ up> (some little long time) <a down> <a up> to get á

barcell1 avatar Oct 14 '24 22:10 barcell1

That would be covered by oneshot(agudo), but how then do you still want to get [?

nsbgn avatar Oct 15 '24 16:10 nsbgn

yes, i still need the [ , so the oneshot would not work , i could not tune the ms time to hold the overload to a little longer ?

barcell1 avatar Oct 15 '24 17:10 barcell1

i could not tune the ms time to hold the overload to a little longer

Perhaps you can, but I'm struggling to answer your question because it is still unclear what you mean exactly. I would encourage you to think about all the different paths that your keypresses can take.

Taken at face value, it sounds like you want a press of [ to produce [ as normal, except when press of a (et al) occurs during or shortly after. You could achieve something like that using oneshotm like so: [^1]

[^1]: There are some caveats, but I won't go into that until I know this is really what you're after :P

[ids]
*

[global]
oneshot_timeout = 100

[main]
[ = oneshotm(agudo, [)

[agudo]
a = macro(backspace á)
e = macro(backspace é)
i = macro(backspace í)
o = macro(backspace ó)
u = macro(backspace ú)

[agudo+shift]
a = macro(backspace Á)
e = macro(backspace É)
i = macro(backspace Í)
o = macro(backspace Ó)
u = macro(backspace Ú)

However, I'm skeptical that that is something that would actually feel good to type, because it means that you would have to consciously pause between [ and a if you want to type [a.

You could also mean by 'extending the hold time' that holding [ down for longer should disable one half of the overload. You could do that by [ = timeout(overload(agudo, [), 200, [) or [ = timeout(overload(agudo, [), 200, layer(agudo)).

You could also put the disambiguation entirely on hold time, like [ = timeout(oneshot(agudo), 200, [). Or perhaps you meant something else entirely.

nsbgn avatar Oct 16 '24 21:10 nsbgn