jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
2.97k stars 125 forks source link

Increased key output latency with tap-hold / home row mods #1349

Closed albu-ali closed 1 day ago

albu-ali commented 1 day ago

Requirements

Describe the bug

I'm experiencing intermittent latency issues while using Kanata on Fedora Linux (41). The exact cause of this issue is unclear, as I'm unsure whether it's related to a problem with my custom config file or an inherent issue with the Kanata software itself. When typing at high speeds (over 100 words per minute), I notice delays, which causes text input feel sluggish. This behavior is consistent occur while using Kanata on my Fedora system.

Relevant kanata config

(defcfg
  process-unmapped-keys yes
) 

(defsrc
        grv  1    2    3    4    5    6    7    8    9     0    -    =    bspc
        tab  q    w    e    r    t    y    u    i    o     p    [    ]    \
        caps a    s    d    f    g    h    j    k    l     ;    '    ret
   lsft 102d z    x    c    v    b    n    m    ,    .     /    rsft
        lctl lmet lalt           spc            ralt rmet  rctl)

(defvar
  tap-time 200
  hold-time 225
)

(defalias
  esccaps (tap-hold 1 200 esc caps)
  ] (tap-hold 1 130 bspc ]) 
  a (tap-hold $tap-time $hold-time a lmet)
  s (tap-hold $tap-time $hold-time s lalt)
  d (tap-hold $tap-time $hold-time d lsft)
  f (tap-hold $tap-time $hold-time f lctl)
  j (tap-hold $tap-time $hold-time j rctl)
  k (tap-hold $tap-time $hold-time k rsft)
  l (tap-hold $tap-time $hold-time l ralt)
  ; (tap-hold $tap-time $hold-time ; rmet) 
)

(deflayer base 
        grv  1    2    3    4    5    6    7    8    9     0    -    =    bspc
        tab  q    w    e    r    t    y    u    i    o     p    [   @]    \
        @esccaps @a   @s   @d   @f    g    h   @j   @k    @l   @;   '    ret
   lsft 102d z    x    c    v    b    n    m    ,    .     /    rsft
        lctl lmet lalt           spc            ralt rmet  rctl)

To Reproduce

  1. Use my config file
  2. Go to any typing test website
  3. Start typing with more then 100 w/m speed

Expected behavior

When using Kanata with a home-row modifier config, I expect the following behavior:

Kanata version

1.6.1

Debug logs

No response

Operating system

Linux

Additional context

No response

jtroo commented 1 day ago

100 words/sec seems quite impossible; that's one character every 2ms?

jtroo commented 1 day ago

Glossing over the numbers, home row mods inherently have a bit of latency/lagginess in the design due to the selection logic of whether tap or hold should activate.

You can do eager-tap with a backtracking hold using backspace but depending on use cases this might be unviable.

jtroo commented 1 day ago

A past related discussion: https://github.com/jtroo/kanata/discussions/1132

albu-ali commented 1 day ago

100 words/sec seems quite impossible; that's one character every 2ms?

I wrote this issue at 3am and I am not a night owl, so I guess you know that w/s is just an error

BTW, Kanata is the best keyboard remapper in my opinion

gerhard-h commented 1 day ago

$tap-time you could try setting $tap-time to 1. It not likely to help but easy to test.

My general advice regarding home row mods: auto switch to a a fast typing layer without home row mods (and only lowercase) But I need that because of unwanted hold activations, but you don't have that issue, so it might not help.

Another (simpler) thing you could try: Only use home row mods for shift and try if the latency issues persist? Only on D and K ?

albu-ali commented 22 hours ago

$tap-time you could try setting $tap-time to 1. It not likely to help but easy to test.

that's didn't help at all!

My general advice regarding home row mods: auto switch to a a fast typing layer without home row mods (and only lowercase) But I need that because of unwanted hold activations, but you don't have that issue, so it might not help.

but still interesting!

Another (simpler) thing you could try: Only use home row mods for shift and try if the latency issues persist? Only on D and K ?

I try it and I see latency only with d and k 🙃 what a surprise

albu-ali commented 22 hours ago

for now I am using only the ; as rmet from home row mods because I don't use ";" that much and it help me a lot in WM!