mathiasbynens / dotfiles

:wrench: .files, including ~/.macos — sensible hacker defaults for macOS
https://mths.be/dotfiles
MIT License
30.39k stars 8.74k forks source link

Key repeat broken in macOS Sierra #687

Open jdsimcoe opened 8 years ago

jdsimcoe commented 8 years ago

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:

screen shot 2016-07-14 at 10 20 05 am

Maybe they changed the preference file location or something.

mathiasbynens commented 7 years ago

@lucascaton That’s what .macos contains right now…

lucascaton commented 7 years ago

@mathiasbynens not really, ApplePressAndHoldEnabled is commented out and won't work out of the box 😁

mathiasbynens commented 7 years ago

@lucascaton What makes you say that? It’s not commented out: https://github.com/mathiasbynens/dotfiles/blob/d6ca39a907123c0a7f874c500ba16cabb3156a63/.macos#L181-L186

lucascaton commented 7 years ago

Ahh, sorry - I was looking at the link mentioned by @gcallaghan previously: https://github.com/gcallaghan/dotfiles/blob/master/.macos#L182

My bad.

PaulCapestany commented 7 years ago

I'm running macOS Sierra 10.12.3, and I concur with @lucascaton. The solution to get the fastest keypress speeds all around is to run the following in your terminal (you can copy-paste the below directly, but note it will restart your computer):

defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false && \
defaults write NSGlobalDomain KeyRepeat -int 1 && \
defaults write NSGlobalDomain InitialKeyRepeat -int 10 && \
sudo reboot

When I attempted lower int values for either KeyRepeat or InitialKeyRepeat, I kept running into issues where my Mac Pro's 4k display literally wouldn't work at all and/or I had to physically reboot my comp (sidenote: potentially an odd/interesting bug? how/why would keypress settings affect display function?)

hassankhan commented 7 years ago

If I'm not mistaken, .macos already seems to be doing that (minus the reboot), @PaulCapestany

PaulCapestany commented 7 years ago

@hassankhan ah, yup, nice catch.

KableM commented 7 years ago

In Sierra you can unplug and replug your external keyboard in for the new values to take effect, no reboot required.

atripes commented 7 years ago

You can also use float like defaults write -g KeyRepeat -float 8.5

weisjohn commented 7 years ago

a long time ago, in https://github.com/mathiasbynens/dotfiles/issues/687#issuecomment-236710547 , @mathiasbynens wanted a diff a b on defaults after changing some settings. I did that just now, and here's my diff:

103c103,104
<         KeyRepeat = 0;
---
>         InitialKeyRepeat = 15;
>         KeyRepeat = 2;
10086,10087c10087,10088
<         SPLoggingWindowHideCount = 6719;
<         SPLoggingWindowShowCount = 6720;
---
>         SPLoggingWindowHideCount = 6720;
>         SPLoggingWindowShowCount = 6721;
10091c10092
<         lastWindowPosition = "{{600, 316}, {680, 430}}";
---
>         lastWindowPosition = "{{600, 690}, {680, 56}}";
19897c19898
<                 Age = "8296.247732316";
---
>                 Age = "8402.392134855001";
20007a20009,20011
>                         56,
>                         1076,
>                         1077,
20010d20013
<                         56,
20897c20900
<         "NSWindow Frame Main Window Frame SystemPreferencesApp 8.0" = "1002 257 668 560 0 0 1920 1057 ";
---
>         "NSWindow Frame Main Window Frame SystemPreferencesApp 8.0" = "1002 274 668 543 0 0 1920 1057 ";

@mathiasbynens thanks for your dotfiles, they've continue to be helpful to me for years and years.

padi commented 7 years ago

Leaving an update here. Using macOS Sierra 10.12.5 and it seems like defaults write -g KeyRepeat -int 0 + logout + login now works, albeit too fast.

The scales have changed drastically, as @hkdobrev has previously stated. I've documented this behavior here:

keyrepeat

Take note that while the GIF is indeed skipping frames, it really does skip some frames until I stop holding the repeating key. It's that fast. The terminal frame skips seem to happen, but they're more evident in my older MacBook, which means this is probably just dependent on how much text the terminal can handle given the limited resources of the laptop.

This behavior "works" on both my 11-inch Mac Book Air (2014) and my 13-inch Mac Book Air (2017). I've since set it to 1, but it 2 can be comfortable as well since the new 1 might be a little bit too fast for some people.

ktgvv commented 6 years ago

@mathiasbynens You could disable Slow Keys before setting key repeat, like so:

defaults write com.apple.universalaccess slowKey -int 0 # Disable Slow Keys.
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool FALSE # Disable Press-And-Hold for keys.
defaults write NSGlobalDomain InitialKeyRepeat -int 10 # Set key repeat triggering delay to even shorter.
defaults write NSGlobalDomain KeyRepeat -int 3 # Set key repeat rate to even faster.
hprobotic commented 5 years ago

In case you guys found default ./.macos setting is too fast. Here is good setting:

defaults write NSGlobalDomain KeyRepeat -int 3
defaults write NSGlobalDomain InitialKeyRepeat -int 20
a-x- commented 4 years ago

It works for me: sudo defaults write NSGlobalDomain KeyRepeat -float 0.000000000001

W/o sudo it does not work

ktgvv commented 4 years ago

wouldn't've thought to try sudo. Does it work for other broken commands?