Hacker News new | past | comments | ask | show | jobs | submit login

Maybe I did something wrong, but for me getting a local X-server running, with X-forwarding from WSL1 was dead easy and something I used on a day to day basis.

Getting the same working with WSL2 was a pain in the ass, and I eventually gave up.

So if you like X-forwarding... I personally would recommend sticking to WSL1, unless that gives you other issues.




> Getting the same working with WSL2 was a pain in the ass, and I eventually gave up.

Overall it works the same as WSL 1, you just need to change DISPLAY=:0 to DISPLAY="$(/sbin/ip route | awk '/default/ { print $3 }'):0"

Here's a snippet from my bashrc that handles both WSL 1 and WSL 2: https://github.com/nickjj/dotfiles/blob/385007837ab787a2be2e...


You can also read the IP from etc/resolv conf.


Thanks for that.


Is "X-forwarding" being able to see and interact with linux GUI apps running inside WSL on Windows? I do this to run Cypress interactively within WSL2.

I have no idea what I did (i just blindly follow some guide on a no-name blog), but I got it all working fairly effortlessly. The only slightly annoying thing is having to start the server on windows if i restart my pc, but otherwise it was pretty easy.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: