AHK_X11 icon indicating copy to clipboard operation
AHK_X11 copied to clipboard

Key repeat for remapped keys

Open davuses opened this issue 2 years ago • 3 comments

Key repeat is not enabled on remapped keys. If I remap up key to combination alt+shift+k, I have to keep hitting k to go up multiple lines.

!+k::Send {UP}       ; i UP          (Cursor up line)

By comparison the up key can automatically move cursor up multiple lines when I press it.

I'm running AHK_X11 on KDE.

davuses avatar Dec 07 '23 06:12 davuses

yeah that's pretty annoying

phil294 avatar Dec 07 '23 23:12 phil294

yeah that's pretty annoying

Any workaround for this issue?

davuses avatar Dec 08 '23 07:12 davuses

Sure, you can write your own key repeat logic:

!+k::
send {up}
sleep 300
loop
{
  sleep 100 ; or how fast else you want this to behave
  GetKeyState, state, k
  if state != D
    break
  send {up}
}
return

Stuff like this may contain bugs (e.g. #26), but this very code sample seems to work fine.

The only downside I can see is that it doesn't synchronize with the actual key repeat configured for your system.

If you have many such remaps, you could even generalize this into a routine that uses the Hotkey command to register them, so then you'll do

hotkey_from = !+k
hotkey_to = {up}
GoSub, register_repeating_hotkey

phil294 avatar Dec 08 '23 16:12 phil294