-
Notifications
You must be signed in to change notification settings - Fork 181
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
mintty is slow to grab focus on startup, which interacts badly with focus-stealing prevention #1113
Comments
There is hardly any terminal that would start "immediately". There are typically a number of parameters, e.g. command-line parameters, that impact the appearance of the terminal, unlike simple system programs like notepad, which may explain some tiny difference. |
On my system, it takes ~130ms from process start until display of the window. |
Applied a few tweaks to get the window to display earlier: |
Actually it seems to be possible to grab the focus even before showing the window, as a workaround to evade the child creation delay for keyboard handling. |
Released 3.5.1. |
At least for me, this seems not to be working as intended (I am on Windows 11, if that makes any difference). I wonder whether we should actually add back the old |
So your focus is still grabbed with a delay, causing symptoms as described above?
|
It is an intermittent issue, for sure. For example, right now I cannot reproduce the issue (I suspect it is less likely to occur directly after a fresh reboot). Once I can reproduce the issue again, I will make sure to try that patch. |
I was just able to reproduce the issue again, and this patch indeed fixed the issue! |
Released 3.6.2. |
None of these tweaks create any focus races when starting Windows |
There's a human-perceptible delay between the mintty process being created and the appearance of the terminal window on the desktop. It's only a fraction of a second, but it creates a bigger problem. I have a hotkey that starts a mintty terminal, and I tend to press the hotkey and then immediately start typing what I want to go into the terminal. Sometimes, the first keystroke precedes the appearance of the terminal window, so it goes to another window. Then (I assume this is what is happening) Windows' focus-stealing prevention algorithm ironically decides that I really wanted to be typing into that other window, and never gives focus to the new terminal. By the time I notice, a number of additional keystrokes have gone to a window that, in many cases, I can't even see any more because the new terminal has appeared on top of it. Cleaning up after this is a pain.
I'm able to consistently reproduce this by pressing my mintty-launching hotkey and then quickly pressing a random key. If I make the same hotkey launch notepad.exe instead, I can't reproduce it, so I think the problem is mintty being slow to grab focus.
I don't know if fixing this is feasible, but it would be nice.
The text was updated successfully, but these errors were encountered: