Open bobf32 opened 1 year ago
@bobf32, thanks for reporting the issue, I do not observe the issue reported, After launching the mintty, the new "Ubuntu-20.04" window open, then the focus is moved to that window from the window launched mintty, So if I type something from keyboard, the input goes to newly opened "Ubuntu-20.04" window, as below shows as I typed "hello". Is this the expected behavior? thanks!
That's pretty much it, but I can simplify. To reproduce:
guiApplications=false
wsl --shutdown
wsl
The window housing the command prompt and now bash session somehow loses focus at this point, and I have to alt-tab or click in it to type into the terminal. Mintty was a red herring, not required to reproduce this.
Further invocations of wsl
occasionally but not always exhibit the same issue, but the numbered steps above are reproducible, i.e. after a shutdown. If I include guiApplications=false
in .wslconfig all is fine.
@bob32, I still don't observe the focus lost with wsl.exe, but starting up WSL with guiApplications enabled involves launching msrdc.exe in background, so it possible that the focus is changed by that, although it might vary by other factors such as host Window's version. Would you please share log files from /mnt/wslg? I would like to double check if there are some unexpected errors, thanks!
@bobf32, thanks for sharing the log, and I do see some clue there, below line in your log indicates there is some UI being created in Linux side, and this is most likely the reason of focus change, and for me, I don't see this until I actually run some GUI apps, like firefox, do you have some custom script to run at startup? thanks!
[22:23:12.933] rdp_rail_wake_handler is called on peer_ctx:0x5559cbf733a0
I have a .bashrc but nothing else that I am aware of. And this does not start any gui stuff I don't think. I don't tend to use gui apps with wsl.
@bobf32, is it possible you can install fresh distro and see if same issue still occurs? and if you have any customization made by c:\Users\[your user name]\.wslconfig or /etc/wsl.conf, please share with us, thanks!
I have just installed a fresh copy of Ubuntu 22.04.2 LTS and the problem still occurs.
Problem occurs now in two distros, and in both cases whether .wslconfig exists or not.
In neither case do I have /etc/wsl.conf.
@bobf32, thanks for trying out. I think, at this point, I will need to have some additional instrumentation to understand this further, and at same time, I will be checking if any repro internally, I will post here if any updates, thanks!
@bobf32, update: I'm able to reproduce the issue on Windows 10 (while I cannot on Windows 11), and it looks you are on Windows 10 as well, and in this case, the window focus is moved to a window created by msrdc.exe (msrdc.exe is indirectly launched by wsl.exe in background). Do you happen to have separate environment on Windows 11? if so, please check if this does not occur on Windows 11, thanks!
Thank you for the update @hideyukn88. I am indeed on Windows 10 but have not got a Windows 11 environment right now. I'll try and spin up a VM when I get some time.
The fix for this focus lost issue went into msrdc.exe code, thanks!
@hideyukn88 Great, is it available yet? What do I need to do to get the fix?
I'm having this problem. It doesn't seem like this fix has been released yet? Is there an ETA?
@hideyukn88 That's great news! How does msrdc.exe get updated? Can I do anything to get it now (maybe wsl --update --pre-release
)? Thanks!
I'm having this exact issue on Windows 11 10.0.22631 N/A Build 22631
, but it's happening with mstsc.exe
rather than msrdc.exe
. Could this fix be implemented there too please?
Windows build number:
19045.2604
Your Distribution version:
22.04
Your WSL versions:
WSL version: 1.1.3.0 Kernel version: 5.15.90.1 WSLg version: 1.0.49 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.2604
Steps to reproduce:
See https://github.com/mintty/wsltty/issues/329
WSL logs:
No response
WSL dumps:
No response
Expected behavior:
No response
Actual behavior:
On starting a new WSL session, the focus should be set to the window containing that session. This is not the case.