Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Programatically Determine Keyboard Repeat Rate

Greetings!

I need to determine the current keyboard repeat rate of the user programatically.
I've found the "KeyRepeat" key in the ~/Library/Preferences/.GlobalPreferences.plist file. It ranges from 120 (slowest) to 2 (fastest). Unfortunately these numbers mean absolutely nothing to me in terms of, say, a loop.

Does anyone know what these numbers mean? I assume they are multiplied by a fixed number in order to get a millisecond result.

Thanks!

MBP 2.4 Santa Rosa, Mac OS X (10.5.1)

Posted on Dec 30, 2007 6:44 PM

Reply
Question marked as Best reply

Posted on Jan 3, 2008 2:09 AM

Using DoubleCommand's kernel interception of keystrokes, plus the incredibly accurate timing provided by kern/clock.h, I've managed to calculate the repeat rate and initial repeat delay formulas. They are very simple, actually.

In ~/Library/Preferences/.GlobalPreferences.plist there are the keys:

InitialKeyRepeat
KeyRepeat

InitialKeyRepeat goes from 300000 (off) to 120 (longest) to 25 (fastest).
KeyRepeat goes from 120 (slowest) to 2 (fastest).

If the InitialKeyRepeat key does not exist, it is assumed to be default at 35.
If the KeyRepeat key does not exist, it is assumed to be default at 6.

The value in both of these keys may be multiplied by 15 to get the timing in milliseconds.

I currently use 25 for initial and 2 for repeat, so my initial delay is 375 milliseconds, with a repeat stroke every 30 milliseconds.

I don't know if this info will be useful to anyone else, but I figured I'd post it here anyway.

-Sastira
3 replies
Question marked as Best reply

Jan 3, 2008 2:09 AM in response to Sastira

Using DoubleCommand's kernel interception of keystrokes, plus the incredibly accurate timing provided by kern/clock.h, I've managed to calculate the repeat rate and initial repeat delay formulas. They are very simple, actually.

In ~/Library/Preferences/.GlobalPreferences.plist there are the keys:

InitialKeyRepeat
KeyRepeat

InitialKeyRepeat goes from 300000 (off) to 120 (longest) to 25 (fastest).
KeyRepeat goes from 120 (slowest) to 2 (fastest).

If the InitialKeyRepeat key does not exist, it is assumed to be default at 35.
If the KeyRepeat key does not exist, it is assumed to be default at 6.

The value in both of these keys may be multiplied by 15 to get the timing in milliseconds.

I currently use 25 for initial and 2 for repeat, so my initial delay is 375 milliseconds, with a repeat stroke every 30 milliseconds.

I don't know if this info will be useful to anyone else, but I figured I'd post it here anyway.

-Sastira

Programatically Determine Keyboard Repeat Rate

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.