dotfiles
dotfiles copied to clipboard
Key repeat broken in macOS Sierra
Currently your script...
defaults write NSGlobalDomain KeyRepeat -int 0
...does not work in macOS Sierra. I've found that if I set things up here they work great:
Maybe they changed the preference file location or something.
I've played with that a bit. I think 0
is no longer allowed as a value, but you could use 1
, 2
etc. It makes it awfully fast then though. So they might have changed the scale. If you set it to the fastest Key Repeat and shortest initial delay and then read the values on the command line you get 2
and 15
.
Tried doing this:
defaults write NSGlobalDomain KeyRepeat -int 1
And here's what I get:
2016-07-14 13:51:07.168 defaults[8647:1323339] Could not write domain Apple Global Domain; exiting
Use diff to compare before and after the changes (quickly). I can't imagine Apple changed this to no longer use NSUserDefaults. Maybe it's not in NSGlobalDomain anymore.
@hkdobrev If it was just a matter of forbidden value, replacing -int 0
with -float 0.001
would have done the trick and been a better way than -int 1
[except if -float
was forbidden too]. ;)
@kvpb Yeah, using float
seems to work (as in, fast keyboard repeat is enabled by it after a reboot):
defaults write NSGlobalDomain KeyRepeat -float 0.000000000001; defaults read-type NSGlobalDomain KeyRepeat; defaults read NSGlobalDomain KeyRepeat
Type is float
1e-12
@mathiasbynens That didn't seem to work.
@jdsimcoe It does for me on OS X El Capitan 10.11.6 (15G31) when rebooting afterwards.
@mathiasbynens I'm on macOS Sierra and that setting has changed or something because neither works at all... they must have changed the value.
@jdsimcoe Could you do this please?
-
defaults read > a
- Open system preferences and change the setting to some other value than the default.
-
defaults read > b
- Post
diff a b
here.
when I do this defaults read NSGlobalDomain KeyRepeat
... I get 1e-12
. When I do defaults read-type NSGlobalDomain KeyRepeat
I get Type is float
.
When I change it in the Preferences slider to the fastest value I do defaults read NSGlobalDomain KeyRepeat
and get 2
. And the type is integer.
@mathiasbynens defaults write NSGlobalDomain KeyRepeat -int 1
is the best I can do on macOS Sierra. The float just doesn't work.
I tried to take a wild guess, I don't have any Mac running macOS Sierra DP. If I get what @mathiasbynens and you @jdsimcoe say, my trick works for OS X 10.11.6 El Capitan but not macOS 10.12 DP4 Sierra. Maybe it actually is a matter of forbidden values.
If -int
works, -float
maybe works too. Have you tried to defaults read NSGlobalDomain KeyRepeat
with the slider put at different random values [not just the extremes and middle but some points here and there on the slider as well]? Right now, the question I'm asking myself is: did Apple reverse how it works [eg a bigger value means a higher rate] or just lock the values to a certain range [eg between 1 and 3]?, and if they did, does setting the slider's cursor to a point somewhere changes from an integer to a floating-point number [eg the extremes and middle at 1, 2 and 3, and the values between as 1.n and 2.n]?
What bugs me is that either the slider is locked to a range of integers such as one integer by stopping point [which would explain why floating-point numbers don't work], the slider is locked to a range of integers by can accept floating-point numbers within that range or something escapes me.
Im on DP 5 and cannot seem to get the float to increase to speeds I was experiencing prior. also, you may need to tweak the InitialKeyRepeat
value if you're getting no key repeat at all.
On macOS build 16a294a, after setting values through the prefs panel (and verifying that it works in the terminal), these are the values I see:
% defaults read NSGlobalDomain ApplePressAndHoldEnabled
0
% defaults read NSGlobalDomain KeyRepeat
6
% defaults read NSGlobalDomain InitialKeyRepeat
25
@wprater InitialKeyRepeat
's value is actually the time it takes for key repeat to initialize, that is how long you have to stay pressing the key before it automatically repeats. Maybe it needs to be set to a shorter value along KeyRepeat
in macOS Sierra?
Also, I highly discommend setting InitialKeyRepeat
lower than [ 7 ; 10 ]: hardly will you press a key that 2 or 3 characters will have been input; on my 2013 MacBook Pro, I can set it to 5 but I need to keep it around 10 on my 2010 MacBook. See my .osxmavericks
for more.
I can't find any command that works for macOS Sierra. Something must have changed ...
Same here. I just ugpraded to Sierra and I had to use... the GUI. And even then key repeat wasn't as fast as it was in El Capitan.
@knpwrs I'm experiencing the same thing. They key repeat set from CLI appears to have no affect. Furthermore, after a reboot, the settings set from the GUI are lost, which means I need to set the preferences every time.
For keyboards and mouse fine-tuning I'm exploring the use of https://pqrs.org/osx/karabiner/ . Only thing is a rewrite of the app is in progress for macOS Sierra support at: https://github.com/tekezo/Karabiner-Elements
@anhkind @knpwrs @danemacmillan @kdeldycke If you want to close to 0
try this:
defaults write NSGlobalDomain KeyRepeat -int 1
It is as close as you can get on macOS Sierra.
For me:
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
makes it blazing fast. Even a bit too much, maybe.
This is sad, I really liked having blazing fast key repeat. Has anyone found anything faster than
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
?
Nothing i've tried has been as fast as keyrepeat 1 and initialkeyrepeat 10 =/ I miss lightning fast, but I imagine i'll get used to this speed shortly.
Just have in mind that you need to restart to apply the changes.
Logging in and out is enough, don't need a full restart.
I found that locking and unlocking my macbook was enough to apply the changes.
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
Seems as fast as before for me once I locked and unlocked my computer.
To be clear:
- the UI sliders within System Preferences > Keyboard do not reflect changes made to
defaults
(or at least do not update if the value is outside a particular range). Previously, setting keyrepeat 0 and initialkeyrepeat 10 would min/max the sliders. - Setting KeyRepeat to a float or zero value actually disables key repeat (e.g. holding a hey does nothing). So seems like
1
is the best we can do for now.
Guys it works pretty awesome and it will be much to fast (at least for me (; ), I was not even able to type. How I got it working (also in iTerm), the min. value for KeyRepeat
seems to be 1 and for InitialKeyRepeat
15 (for fast repeat) via System Preferences
, by using the following values:
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
after it I closed all applications and explicit called the "Logout". Maybe you should also try to keep the System Preferences closed or at least not pointing to the keyboard configuration.
PS: I guess that float values are also working since the KeyRepeat value could be set on previous Mac OS X versions to float value.
Regarding settings not being applied, I proposed some days ago to kill any instance of System Preferences to keep it from interfering. My PR is ready to merge at: https://github.com/mathiasbynens/dotfiles/pull/706