-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Not respecting key repeat OS setting #2026
Comments
Measured the speed difference: |
I just tried on my machine (Monterey, M2, latest AltTab), and when I change the key repeat, or key repeat delay, AltTab correctly follows. When I slow it down, or speed it up, AltTab slows down or speeds it, and at the same speed as the system. I'm not sure how to debug what's unique to your setup. Maybe you use an external keyboard, or software that interfere with key presses (e.g. BTT, Karabineer, etc)? Maybe you could try resetting AltTab's preferences (at the bottom of the first preferences tab) and see if it fixes it for you? |
I use an Apple Magic Keyboard on an x86 iMac. I do have Karabiner but disabled it when testing this. Will try resetting the preferences |
Resetting the preferences fixed it, thanks! Only used AltTab for a few weeks, so not sure what caused it, maybe an update or something |
I think you may have set it manually. The Key Repeat value can be overriden for specific app. I'm guessing that you ran something like Or it could be something else like migrating your mac, or who knows. Anyway, glad it's fixed 👍 |
@lwouis Just restarted my pc, and the issue came back. I have AltTab set to start at login. Relaunching AltTab fixes it. Maybe it tries to read the key repeat setting too early? |
This is very unexpected. What does this command return?
|
Right now it says this:
|
The KeyRepeat preference is read every time you press and hold the The code grabs that value from the OS, which reads from the System Preferences, or from the app's preference (see the command I gave you above) if defined (manually since AltTab has no UI to override it at app-level). Finally, if somehow the OS returns no value, it defaults to I'm out of idea on what could possibly be happening on your system. I can't reproduce on my machine. I strongly suspect you have some hardware and/or software intervening here. An idea maybe: are you sure you only have 1 instance of AltTab running? Can you check your top menubar, and/or Activity Monitor? I've seen issues in the past with people having multiple instances at once, which could then have the |
Tried restarting, and there's only one AltTab instance. Tried manually setting Edit: I checked |
@probablykasper I'm not sure to follow:
Then your conclusion is that AltTab respects the value, at system-level and app-level? |
Sorry, let me clarify. I tried manually setting the KeyRepeat to what my OS has, and it didn't change the key repeat. If I then change it to 6, it gets updated, but it's still slower than what a key repeat of 6 should be. So it does read the key repeat value, but whatever the value is, it seems to be slowed down |
At this point, is AltTab repeat rate matching the OS repeat rate? |
When the bug happens, it's not matching the OS repeat rate or the manual repeat rate, but it does read it. If the setting is changed, AltTab changes too, but it's slower than what it should be |
I'm still not clear on what the various settings do 😅 Could you please fill this table? Feel free to add more values you experimented with.
|
All good, sorry for not explaining it well enough. The observed repeat-rate is x% slower than the
|
|
60 Hz
Unfortunately not. Might not have anything at all to do with AltTab, but for the first 15-30s the tab repeat was a bit laggy, as in some key repeats were delayed/inconsistent. Probably just because I just restarted my pc, but thought I'd mention it
Sorry, I meant after relaunching AltTab, not restarting |
I don't see that speed-up on the video. When you press the trigger key (e.g. Both To me, what is happening in your video is expected behavior. Your main issue is that AltTab is not at the same speed as other apps in the OS, sometimes, right? You showed in the video in the OP that the native app-switcher is faster than AltTab. I don't know how to explain that. It's exactly at the same speed on my machine. Is everything in your system at the same speed? Like if you select a file in a folder with many files, and you hold But then in your later comments here, you say that if you don't set any variable for AltTab, it's first too slow, then after you restart AltTab, it's at the correct speed. This seems to contradict your original post at the top, where you had not set any variable, but you showed on the video that it's too fast, not too slow. I'm getting lost with what behavior is the problem in this ticket 😅 |
Thank you for all the clarifications! I'm really not sure what could be at play here. The fact that restarting AltTab fixes the issue seems to imply that AltTab code is correct, but that there is something about its environment that can vary. For example, maybe at launch, the OS provides the wrong value somehow? Or maybe the AltTab process launched by launchd gets lower priority for its timers and they get slowed down. Not sure. The fact that i can't reproduce it makes it hard to investigate. |
I don't think that's it because AltTab reacts to when the KeyRepeat value is changed Maybe this could somehow be fixed by using a different approach to handling key presses, where AltTab itself doesn't handle key repeat/delay itself? I know for example Contexts doesn't have this issue. |
Regarding the inconsistent pacing of the repeat keys, the only explanation I see is in Apple documentation for
So essentially the system doesn't honor user timer strictly. Thus we may drop frames here and there. In addition, we do some UI rendering stuff. Maybe the repeat events are perfectly fired (seems to be the case when I measure), but then the UI rendering of moving the selection around has some rendering costs and lags a few frames sometimes. It's my best guess. Unfortunately, I spend hours upon hours on this topic already (see the length of #563), and I think it's good enough at this point. I need an absolute expert in AppKit now to push the performance to be smoother. Regarding the issue in the OP: after a fresh restart of the machine, AltTab is twice as slow to repeat. I'm not sure what to think here. The difference between this and after restart would be that at login it's launched by A way to test if the initiator/parent is the issue is to logout -> login fresh, then restart AltTab but not manually. Instead restart it using launchd itself by running If it's still too slow, then it means the app being launched by launchd is the issue. If it's at correct speed, then something else happens at login. @probablykasper could you please confirm what happens here? |
All good, I only mentioned it in case it was related. Sounds like it isn't, so it's all good. When I run If I quit AltTab and then run |
Thank you. So, what's the repeat rate after your restart with the command? |
With the command I mentioned, it seems to be as slow as in the original video |
Oh, that's big news! It means it's launchd who creates the sluggishness. Can you run the command a few times and really confirm that it's slow? And then maybe quit and start AltTab manually and confirm that it doesn't have the issue that way? |
Yeah, can confirm that's the case |
I was able to reproduce the issue on my machine! That's a great step. Now I can investigate what is going on. Thanks @probablykasper for you support~ |
Awesome !! :D |
Timer ticks, in milliseconds, when AltTab is launched by the user:
Timer ticks, in milliseconds, when AltTab is launched by
So, timer ticks, with |
I found the issue! When launched through This is an amazing discovery that will improve the overall performance/snapiness of AltTab, when launched after a restart. I'm very grateful to you @probablykasper for having supported me in this investigation. The fruit of this work will benefit many users that may finally be rid of "absorbed" key presses and other visual lags. Can you confirm that this build fixes the issue for you like it does for me? |
# [6.49.0](v6.48.0...v6.49.0) (2022-11-02) ### Bug Fixes * command+backtick not working if stage manager is on (closes [#2053](#2053)) ([848ae5f](848ae5f)) * crash when setting some shortcut combinations (closes [#2061](#2061)) ([8b2d659](8b2d659)) * hide minimize and fullscreen thumbnail buttons for tabs ([b62c422](b62c422)) * improve key repeat-rate when held (closes [#2026](#2026)) ([1821dea](1821dea)) * key-above-tab on international keyboards (closes [#1190](#1190)) ([4c31740](4c31740)) * thumbnails would sometimes be the wrong size ([1065c0d](1065c0d)) * wrong focus after active app becomes windowless (closes [#2065](#2065)) ([281b3ed](281b3ed)) ### Features * improve some localizations ([292e6b0](292e6b0)) * play alert sound for unavailable thumbnail shortcuts ([fd84a9a](fd84a9a)) * support adobe after effects non-standard windows (closes [#1982](#1982)) ([7b54873](7b54873))
Yes, that build fixed it!! Amazing work, thank you so much |
Describe the bug
AltTab key repeat is a lot slower than what I've set my OS key repeat setting to (I have key repeat on the fastest setting)
Screenshots / video
AltTab vs macOS cmd+tab:
Screen.Recording.2022-10-19.at.7.35.37.mp4
Steps to reproduce the bug
Versions
AltTab: 6.47.0
OS: macOS Catalina 10.15.7
The text was updated successfully, but these errors were encountered: