cascadium/wsl-windows-toolbar-launcher

Not being able to access X server without mods

thjwong opened this issue · 1 comments

All applications except the terminal applications were not able to access the X server (VcXsrv):

I have to add the following code to the .bat files before calling the wsl.exe in order to make them work:

for /f "tokens=3 delims=: " %%i in ('netsh interface ip show config name^="Wireless" ^| findstr "IP Address" ^| findstr [0-9]') do set DISPLAY=%%i:0.0

set WSLENV=DISPLAY/u

If x forwarding is not working, it's most likely a firewall or addressing issue. What you're doing there is connecting to X through your wireless interface's IP (which is likely a private network as opposed to WSL which for some random reason is registered as a "public" network and therefore has different firewall rules).

It's a common shortcut that a lot of people end up taking, but ultimately it shouldn't be required. You could also do the same thing in .bashrc if you like without having to modify the .bat files which could be a little easier to manage going forward if you really wanted to go down this road.

Setting an appropriate .bashrc and ensuring the firewall rule updates as documented here should be enough to get up and running.