Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key repeat for remapped keys #68

Open
davuses opened this issue Dec 7, 2023 · 3 comments
Open

Key repeat for remapped keys #68

davuses opened this issue Dec 7, 2023 · 3 comments

Comments

@davuses
Copy link

davuses commented Dec 7, 2023

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.

@phil294
Copy link
Owner

phil294 commented Dec 7, 2023

yeah that's pretty annoying

@davuses
Copy link
Author

davuses commented Dec 8, 2023

yeah that's pretty annoying

Any workaround for this issue?

@phil294
Copy link
Owner

phil294 commented Dec 8, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants