wslg icon indicating copy to clipboard operation
wslg copied to clipboard

mstsc keeps launching and steals desktop focus

Open ThomsonTan opened this issue 3 years ago • 10 comments

Windows build number:

10.0.22621.819

Your Distribution version:

20.04

Your WSL versions:

Invalid command line option: --version Copyright (c) Microsoft Corporation. All rights reserved.

Usage: wsl.exe [Argument] [Options...] [CommandLine]

Steps to reproduce:

Haven't got stable repro steps.

WSL logs:

No response

WSL dumps:

No response

Expected behavior:

No response

Actual behavior:

wslhost.exe keeps launching and exit with below command line. And the mstsc steals desktop focus which make it very hard to even input a letter into the focused app like browser. Issue goes away once I run wsl --shutdown.

mstsc.exe /v:89C39F7F-2DF1-41A7-AA4B-6ADE1C89B0A6 /hvsocketserviceid:1661F716-FACB-11E6-BD58-64006A7986D3 /silent /wslg /plugin:WSLDVC /wslgsharedmemorypath:WSL\89C39F7F-2DF1-41A7-AA4B-6ADE1C89B0A6\wslg C:\ProgramData\Microsoft\WSL\wslg.rdp

ThomsonTan avatar Nov 19 '22 06:11 ThomsonTan

Having the same issue - seeing other issues on here as well.

Did you ever figure anything out?

"wsl --shutdown" makes it stop for me - but that puts Docker Desktop into a bad state on my machine, so it's not an idea workaround...

Based on some other reports, I'm wondering if I'm encountering it due to running VSCode from within WSL - as it seems there's a relation between launching WSL GUI apps and this issue occurring for some. This somewhat makes sense to me, as I've used WSL for years but only recently began experiencing this problem - and I only recently switched to working "inside of WSL" with regards to launching VSCode.

mattezell avatar Apr 21 '23 09:04 mattezell

Very serious problem.. can this get some attention?

Radivarig avatar Apr 23 '23 19:04 Radivarig

Also just discovered this.

jbostoen avatar Jul 14 '23 11:07 jbostoen

I came across the same issue.

Euynac avatar Jul 16 '23 09:07 Euynac

This had been affecting me for several years and still isn't fixed in latest WSL. Much more detail here: https://youtrack.jetbrains.com/issue/IDEA-282196/Constant-loss-of-editor-focus-when-using-Windows-11-and-WSL

ejohb avatar Aug 22 '23 17:08 ejohb

Is this being worked on? Every time I remove guiApplications=false from my .wslconfig, my focus keeps being stolen. Very annoying.

Alistair1231 avatar Sep 26 '23 07:09 Alistair1231

This might be unrelated, but I had a similar issue with mstsc --- I think I isolated this for myself to explorer's side tree "Linux" folder --- when this opens, it launches every WSL VM. ... the more you have the more it times it loses focus as it opens each one at a time it seems.. Hoping this helps someone else out there. Ensuring the tree is closed makes it not try to start all the VMs.

cwg999 avatar Dec 30 '23 21:12 cwg999

Still happening. For me it just starts after a while and then keeps increasing to the point of loosing focus multiple times per second, which basically only gives me the option to restart the PC. I checked the process that started this and it was Microsoft Windows Subsystem Service Host

DavidMarquezF avatar Oct 15 '24 10:10 DavidMarquezF

Came to report I'm affected by it. I found that I lose focus to mstsc.exe which is launched by wsl.

rlesac avatar Jan 05 '25 02:01 rlesac

Linux always gets such problems where you spend a few days to make peanuts work

NoisyLion avatar Oct 01 '25 12:10 NoisyLion