In Windows 11 when I alt-tab into sublime, within 1-3 seconds it loses focus. Extremely aggravating. I can then switch around for about 30 seconds, then the cycle repeats. I disabled all user packages and it still happens.
BUT, it doesn’t happen in safe mode. Any ideas?
Losing focus constantly
This likely happens if a plugin executes a shell command / program without setting up proper startupinfo
structure, which causes dos command window to pop up causing main window to loose focus.
It not happening in SAFE MODE most likely indicates not all user packages to have been disabled.
If it is not caused by a plugin any other external background process might be causing it.
Thanks, I have figured this out. Sublime Text launches windows with elevated “remote” ExStyle flags (0xE0000888 and 0xE0000900)
WSL2 runs as a virtual machine, and to support GUI Linux applications, Microsoft built a remote display protocol into it. msrdc.exe in the WSL directory isn’t actually Remote Desktop - plugs into the same Windows window management system that Remote Desktop would use.
So what was likely happening:
- WSL2’s GUI system (msrdc.exe) registers itself as a “remote display provider” with Windows
- When certain window focus events happen (like alt-tab or app launches)
- Windows checks with all registered display providers about window management
- The WSL2 GUI system gets confused and tries to grab focus, thinking it needs to handle the window
- This manifests as the “Remote Desktop” focus stealing because it’s using similar underlying Windows APIs