How can I increase the key repeat rate beyond the OS's limit?

43,439

Solution 1

On Mac OS X, open the Global Preferences plist

open ~/Library/Preferences/.GlobalPreferences.plist

Then change the KeyRepeat field. Smaller numbers will speed up your cursor rate. The settings dialog will only set it to a minimum of 2, so if you go to 0 or 1, you'll get a faster cursor.

I had to reboot for this to take effect.

Solution 2

In Windows you can set this with a system call (SystemParametersInfo(SPI_SETFILTERKEYS,...)).

I wrote a utility for myself: keyrate <delay> <repeat>.

Github repository.

Full source in case that link goes away:

#include <windows.h>
#include <stdlib.h>
#include <stdio.h>

BOOL parseDword(const char* in, DWORD* out)
{
   char* end;
   long result = strtol(in, &end, 10);
   BOOL success = (errno == 0 && end != in);
   if (success)
   {
       *out = result;
   }
   return success;
}


int main(int argc, char* argv[])
{
   FILTERKEYS keys = { sizeof(FILTERKEYS) };

   if (argc == 1)
   {
      puts ("No parameters given: disabling.");
   }
   else if (argc != 3)
   {
      puts ("Usage: keyrate <delay ms> <repeat ms>\nCall with no parameters to disable.");
      return 0;
   }
   else if (parseDword(argv[1], &keys.iDelayMSec) 
         && parseDword(argv[2], &keys.iRepeatMSec))
   {
      printf("Setting keyrate: delay: %d, rate: %d\n", (int) keys.iDelayMSec, (int) keys.iRepeatMSec);
      keys.dwFlags = FKF_FILTERKEYSON|FKF_AVAILABLE;
   }

   if (!SystemParametersInfo (SPI_SETFILTERKEYS, 0, (LPVOID) &keys, 0))
   {
      fprintf (stderr, "System call failed.\nUnable to set keyrate.");
   }

   return 0;
}

Solution 3

Many times I want to center a function in my window. Scrolling is the only way. Also, Ctrl-left/right can still be slow in code where there are a lot of non-word characters. I use keyboardking also. It has a couple of isssues for me though. One, it sometimes uses the default speed instead of the actual value I set. The other is sometimes it ignores the initial delay. I still find it very useful though. They said 4 years ago they would release the source in 6 months... :(

Ok, on the suggestion of someone that modified HCU\...\Keyboard Response, this works well for me.

[HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response]
"AutoRepeatDelay"="250"
"AutoRepeatRate"="13"
"BounceTime"="0"
"DelayBeforeAcceptance"="0"
"Flags"="59"

Windows standard AutoRepeat delay. 13 ms (77 char/sec) repeat rate. flags turns on FilterKeys? These values are read at login. Remember to log out and back in for this to take effect.

Solution 4

For Windows, open regedit.exe and navigate to HKEY_CURRENT_USER\Control Panel\Keyboard. Change KeyboardSpeed to your liking.

Solution 5

Keyboard preferences window

As mentioned by the hyperlogic, on Mac OS X, internally, there are two parameters dealing with the keyboard speed: KeyRepeat and InitialKeyRepeat. In the System Preferences they are mapped to the Key Repeat Rate and the Delay Until Repeat sliders. The slider ranges and the associated internal parameter values (in parenthesis) are show below. They seem to be multipliers of the 15 ms keyboard sampling interval.

Key Repeat Rate (KeyRepeat)                 Delay Until Repeat (InitialKeyRepeat)
|--------------------------------|          |----------------------|-----------------|
slow (120)                      fast (2)    off (30000)            long (120)        short (25)
0.5 char/s                      33 char/s       

Fortunately, these parameters can be set beyond the predefined limits directly in the ~/Library/Preferences/.GlobalPreferences.plist file. I found the following values most convenient for myself:

KeyRepeat = 1         --> 1/(1*15 ms) = 66.7 char/s
InitialKeyRepeat = 15 --> 15*15 ms = 225 ms

Note that in the latest Mac OS X revisions the sliders are named slightly differently.

Share:
43,439
Frank Krueger
Author by

Frank Krueger

I am an engineer living in Seattle. I have been programming for about 15 years. I started out with video game hacking with the Code Alliance. Moved on to embedded systems development in an R&amp;D group at GM. Did way too much graphics (3D) programming. Then did a lot of network programming for large data centers. Was forced to get my Master's in Electrical Engineering. Got into compiler and interpreter development. Spent some time coding at Microsoft. Moved on a year later to start my own company creating control systems and web apps. I love programming and have spent way too much time learning too many languages, frameworks, APIs, paradigms, and operating systems. Super Secret Code: pL95Tr3

Updated on June 27, 2021

Comments

  • Frank Krueger
    Frank Krueger about 3 years

    I have a bad habit of using the cursor keys of my keyboard to navigate source code. It's something I've done for 15 years and this of course means that my navigating speed is limited by the speed of the keyboard. On both Vista and OS X (I dual boot a MacBook), I have my key repeat rate turned all the way up. But in Visual Studio, and other apps, the rate is still much slower than I would prefer.

    How can I make the key repeat rate faster in Visual Studio and other text editors?