You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows window constantly losing focus and flickering #443
Windows build number: 10.0.22449.0
Your Distribution version: Ubuntu
Your WSLg version: 1.0.27
Two of my PC faced the same issue. The Intel one occurred more times than the first.
1. AMD 5800x + NVIDIA 1070ti latest driver 471.96
2. Intel i7-10510U UHD620 latest driver 30.0.100.9805
Steps to reproduce
It appears itself sometime after using WSL, even don't start a wslg window.
Then the window with focus will constantly losing focus. E.g. Windows Terminal, The title bar is flickering showing it is losing focus and gaining focus. But I can't type any word into it. Only a quick Mouse click and type can input one char into terminal. After input wsl --shutdown then everything is normal.
VID_20210909_135128.mp4VID_20210909_135320.mp4
WSL logs:
Attach WSLg logs from /mnt/wslg
You can access the wslg logs using explorer at: \\wsl$\<Distro-Name>\mnt\wslg (e.g.: \\wsl$\Ubuntu-20.04\mnt\wslg)
Reacted by Rodrigo Groener, Jordan Janzen, Daisuke Takahashi, Mikira Sora, Chaoses-Ib, Jack Ivy, Lev Yastrebov, Dustin Dowell, Mitch Talmadge, retrievaaaa and 18 more
FireFox (@FireFoxAhri), thanks for additional info, by looking at your weston.log, it looks weston (WSLg's wayland compositor) is keep restarting, (while it shouldn't case the focus lost in Windows side, but) I would like to know why it's restarting first. Do you see any core dumps are created at /mnt/wslg/dumps? thanks!
Hideyuki Nagase (@hideyukn88) ,Thanks for helping to solve this problem. the Intel one is my working PC. So I need to wait until Monday to see it. Sorry for the inconvenience. I'll try to see if I can reproduce in my home PC, It happens rarely than Intel one.
Guys, I am suffering from the same thing - it's impossible to work as the focus is being stolen by the mstsc process spawned by wslhost. Looking at my Windows update I see I have last installed "Windows Subsystem for Linux WSLg Preview - 1.0.26" on Oct 29. Is the solution to disable it and wait for 1.0.28?
This issue makes the Greenshot screen capture utility non-functional. I only see the problem with systems that have a NVIDIA GPU. On my laptop, if I disable the NVIDIA GPU and only use the Intel GPU, Greenshot works fine.
I experienced a similar problem with 1.0.26 on Win11 22000.348: mstsc stole focus (verified with WindowFocusLogger) once every minute or so when any WSL distros were running, including those used by Docker Desktop. After installing 1.0.28 prerelease, it has not happened. I'll update if it does.
My GPU is AMD RX 6700 XT with driver 21.11.3.
EDIT: Have not noticed this problem since installing 1.0.28 prerelease.
There is a terminal issue that references to here. Unless one sets guiapplications=false, the terminal window loses focus right after launch. The terminal issue has been closed as a duplicate of this, but even despite running the most recent WSL, the issue persists.
same here with a fresh Ubuntu install on wsl2.
opening a fresh terminal session launches a new tab which loses focus right away. it doesn't happen once wsl is up and running when opening subsequent tabs.
I have the same issue as mentioned by rommeswi and Olaf (@olaf-k), The issue only occurs with wslg in Windows Terminal (but works as expected when guiapplications=false is set in .wslconfig). The issue is very similar to microsoft/terminal #13388. It does not occur with Command Prompt or Powershell, only WSL, and only on the first launch; once running, new Terminal windows open as expected. If one runs wsl --shutdown and then relaunches, the issue occurs once again.
Versão do WSL: 1.2.5.0
Versão do kernel: 5.15.90.1
Versão do WSLg: 1.0.51
Versão do MSRDC: 1.2.3770
Versão do Direct3D: 1.608.2-61064218
Versão do DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Versão do Windows: 10.0.22621.1702
Same issue for me after installing the latest WSL on a new machine using wsl --install -d Ubuntu-22.04 --web-download since business restrictions prevent using the Store directly.
After starting Ubuntu 22.04 in WSL, focus was constantly being removed from any window until WSL was shutdown.
Thanks for reporting the issue, this is known issue and there are several root causes, some fixes are underway, some is understood, but no fix, and there might be unknowns. Below is cut & paste from what I posted at other issue.
Currently there is a few known issues can lead this situation.
2: Your organization deployed certain group policies to block remote desktop connection from your local computer. One of the most common policies we are aware of is, RDP signing requirement policy, when it is enabled, msrdc.exe for WSLg failed and enter restarting loop silently. This is because RDP file used with WSLg is not signed by Microsoft or any certificate your local computer trust. (Given WSLg is open source project, currently there is difficulties to have Microsoft signed RDP file). We are actively working with related groups within Microsoft to have solution, but not yet at this point.
3: There is another group policy let silently fail remote desktop connection, which we are not aware of. If your local computer is managed by your organization and experiencing this issue, please share the output from reg QUERY "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /S.
4: If none of above, there is some unknown things happen in WSLg VM, this case, we will need dumps/logs from /mnt/wslg/dumps or /mnt/wslg/*.log. If you hesitate to share files directly at here. please submit file via Feedback Hub. and let us know the feedback ID. (Note: these folders are clean up at every WSL startup, thus files need to be captured while active WSL instance is experiencing the issue).
5: There is one known issue causing WSLg compositor in Linux (weston) during handshake with msrdc.exe, which is tracked by #901.
6: at last, in order to mitigate this issue, #1082 is submitted.
If there is any question, feel free to post question here, thanks!
2: Your organization deployed certain group policies to block remote desktop connection from your local computer. One of the most common policies we are aware of is, RDP signing requirement policy, when it is enabled, msrdc.exe for WSLg failed and enter restarting loop silently. This is because RDP file used with WSLg is not signed by Microsoft or any certificate your local computer trust. (Given WSLg is open source project, currently there is difficulties to have Microsoft signed RDP file). We are actively working with related groups within Microsoft to have solution, but not yet at this point.
How can I see if this policy impacts me?
3: There is another group policy let silently fail remote desktop connection, which we are not aware of. If your local computer is managed by your organization and experiencing this issue, please share the output from reg QUERY "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /S.
4: If none of above, there is some unknown things happen in WSLg VM, this case, we will need dumps/logs from /mnt/wslg/dumps or /mnt/wslg/*.log. If you hesitate to share files directly at here. please submit file via Feedback Hub. and let us know the feedback ID. (Note: these folders are clean up at every WSL startup, thus files need to be captured while active WSL instance is experiencing the issue).
Update: The issue was being caused from a enterprise policy registry entry.
Please check Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Terminal Server Client in registry for an entry called EnableAdvancedRemoteFXRemoteAppSupport. Removing this helped me solve the issue, I can run UIs again after disabling the flag.
More info here: microsoft/WSL#9752
I dont have the losing focus and flickering anymore, but I seriously dont know how to report this to Windows terminal through a lot of closed issues (came from wt's issue repo) so I will leave it here. for future seekers.
Activity
hideyukn88 commentedon Sep 9, 2021
FireFox (@FireFoxAhri), thanks for reporting the issue. For diagnostics purpose, would you please disable Linux GUI support by adding below to .wslconfig (refer https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig), and if the problem persist? thanks!
[wsl2]
guiapplications=false
FireFoxAhri commentedon Sep 10, 2021
After set this option. I don't faced the issue.
My typical usage of WSL is VS Code remote WSL and compile and debug C/C++ projects.
Then I delete the config the problem comes again quickly.
hideyukn88 commentedon Sep 10, 2021
FireFox (@FireFoxAhri), thanks for additional info, by looking at your weston.log, it looks weston (WSLg's wayland compositor) is keep restarting, (while it shouldn't case the focus lost in Windows side, but) I would like to know why it's restarting first. Do you see any core dumps are created at /mnt/wslg/dumps? thanks!
FireFoxAhri commentedon Sep 11, 2021
Hideyuki Nagase (@hideyukn88) ,Thanks for helping to solve this problem. the Intel one is my working PC. So I need to wait until Monday to see it. Sorry for the inconvenience. I'll try to see if I can reproduce in my home PC, It happens rarely than Intel one.
FireFoxAhri commentedon Sep 13, 2021
core.zip
After this issue appears again, there is one core.weston. Hideyuki Nagase (@hideyukn88)
hideyukn88 commentedon Sep 16, 2021
FireFox (@FireFoxAhri), thanks for sharing the core dump with me. I looked at the dump and confirmed this is fixed by microsoft/weston-mirror#39, and the fix is a part of https://github.com/microsoft/wslg/releases/tag/v1.0.28 release. Thanks!
BladeMF commentedon Nov 1, 2021
Guys, I am suffering from the same thing - it's impossible to work as the focus is being stolen by the mstsc process spawned by wslhost. Looking at my Windows update I see I have last installed "Windows Subsystem for Linux WSLg Preview - 1.0.26" on Oct 29. Is the solution to disable it and wait for 1.0.28?
ielbury commentedon Nov 12, 2021
This issue makes the Greenshot screen capture utility non-functional. I only see the problem with systems that have a NVIDIA GPU. On my laptop, if I disable the NVIDIA GPU and only use the Intel GPU, Greenshot works fine.
Disabling WSLg works fine for all GPU's.
RodrigoGroener commentedon Nov 24, 2021
maybe it's a dump question, but how can i install the 1.0.28 prerelease edition?
Biswa96 commentedon Nov 24, 2021
The installer is just a MSI file. So, a simple double click may do the trick 🤞
RodrigoGroener commentedon Nov 25, 2021
After installing the 1.0.28 prerelease version I'm not able to reproduce the error.
sharpjs commentedon Dec 7, 2021
I experienced a similar problem with 1.0.26 on Win11 22000.348:
mstscstole focus (verified with WindowFocusLogger) once every minute or so when any WSL distros were running, including those used by Docker Desktop. After installing 1.0.28 prerelease, it has not happened. I'll update if it does.My GPU is AMD RX 6700 XT with driver 21.11.3.
EDIT: Have not noticed this problem since installing 1.0.28 prerelease.
37 remaining items
hideyukn88 commentedon Jan 23, 2023
Mitch (@eightbit), you do not need to uninstall previous WSL, and no need to reinstall docker containers, thanks!
eightbit commentedon Jan 23, 2023
Hideyuki Nagase (@hideyukn88) That worked. Thanks a ton!
rommeswi commentedon Apr 20, 2023
There is a terminal issue that references to here. Unless one sets guiapplications=false, the terminal window loses focus right after launch. The terminal issue has been closed as a duplicate of this, but even despite running the most recent WSL, the issue persists.
WSL version: 1.2.0.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
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.22621.1555
olaf-k commentedon May 5, 2023
same here with a fresh Ubuntu install on wsl2.
opening a fresh terminal session launches a new tab which loses focus right away. it doesn't happen once wsl is up and running when opening subsequent tabs.
nx-frost commentedon Jun 10, 2023
I have the same issue as mentioned by rommeswi and Olaf (@olaf-k), The issue only occurs with wslg in Windows Terminal (but works as expected when
guiapplications=falseis set in.wslconfig). The issue is very similar to microsoft/terminal #13388. It does not occur with Command Prompt or Powershell, only WSL, and only on the first launch; once running, new Terminal windows open as expected. If one runswsl --shutdownand then relaunches, the issue occurs once again.lsborg commentedon Jun 14, 2023
Same here using powershell. Very annoying!!!!
MallocArray commentedon Jun 28, 2023
Same issue for me after installing the latest WSL on a new machine using
wsl --install -d Ubuntu-22.04 --web-downloadsince business restrictions prevent using the Store directly.After starting Ubuntu 22.04 in WSL, focus was constantly being removed from any window until WSL was shutdown.
Accessing Windows 10 VM via Citrix
adding
guiApplications=falseto .wslconfig got me working for now.tig commentedon Jul 20, 2023
Same issue just started happening for me.
guiApplications=falsestops the flickering.hideyukn88 commentedon Jul 20, 2023
Thanks for reporting the issue, this is known issue and there are several root causes, some fixes are underway, some is understood, but no fix, and there might be unknowns. Below is cut & paste from what I posted at other issue.
Currently there is a few known issues can lead this situation.
1: If you have Citrix application installed, this applies to any Microsoft remote desktop software usage including WSLg, Citrix has KB published at https://support.citrix.com/article/CTX107825/how-to-disable-citrix-api-hooks-on-a-perapplication-basis. We have possible solution for this from Microsoft side, currently it's estimated to be released as WSL update by end of August.
2: Your organization deployed certain group policies to block remote desktop connection from your local computer. One of the most common policies we are aware of is, RDP signing requirement policy, when it is enabled, msrdc.exe for WSLg failed and enter restarting loop silently. This is because RDP file used with WSLg is not signed by Microsoft or any certificate your local computer trust. (Given WSLg is open source project, currently there is difficulties to have Microsoft signed RDP file). We are actively working with related groups within Microsoft to have solution, but not yet at this point.
3: There is another group policy let silently fail remote desktop connection, which we are not aware of. If your local computer is managed by your organization and experiencing this issue, please share the output from reg QUERY "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /S.
4: If none of above, there is some unknown things happen in WSLg VM, this case, we will need dumps/logs from /mnt/wslg/dumps or /mnt/wslg/*.log. If you hesitate to share files directly at here. please submit file via Feedback Hub. and let us know the feedback ID. (Note: these folders are clean up at every WSL startup, thus files need to be captured while active WSL instance is experiencing the issue).
5: There is one known issue causing WSLg compositor in Linux (weston) during handshake with msrdc.exe, which is tracked by #901.
6: at last, in order to mitigate this issue, #1082 is submitted.
If there is any question, feel free to post question here, thanks!
tig commentedon Jul 20, 2023
I don't use Citrix.
How can I see if this policy impacts me?
See attached.
pulseaudio.log
stderr.log
wlog.zip
weston.log
FilipMitrevFugro commentedon Sep 6, 2023
Confirming this on a fresh Win10. disabling GUIs is not really a solution to the problem.
FilipMitrevFugro commentedon Sep 7, 2023
Update: The issue was being caused from a enterprise policy registry entry.
Please check Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Terminal Server Client in registry for an entry called EnableAdvancedRemoteFXRemoteAppSupport. Removing this helped me solve the issue, I can run UIs again after disabling the flag.
More info here:
microsoft/WSL#9752
shafayetejaman commentedon Dec 29, 2024
EnableAdvancedRemoteFXRemoteAppSupport entry does not exist for me
the loss of focus on startup is still not solved
mbravorus commentedon May 10, 2025
same, suggested registry entry doesn't exist for me, and WSL2 terminal window does ALWAYS lose focus on startup
groutoutlook commentedon Aug 31, 2025
as of today while using
wtandwslpre-release:I dont have the losing focus and flickering anymore, but I seriously dont know how to report this to Windows terminal through a lot of closed issues (came from wt's issue repo) so I will leave it here. for future seekers.