How to set up working X11 forwarding on WSL2

前端 未结 14 2222
灰色年华
灰色年华 2020-12-12 12:09

When moving from WSL1 to WSL2 many things change; apparently this applies to X11 forwarding as well.
What steps do I need to make in order to use X11 forwarding with WSL

14条回答
  •  眼角桃花
    2020-12-12 12:38

    I've managed to work with the out-of-the-box VcXsrv firewall configuration (i.e., no need to override/disable any firewall rules) by using the LAN adapter IP of the Windows host. Added the below to my ~/.bash_aliases

    export DISPLAY=$(pwsh.exe -c ipconfig | grep -A 3 lan | grep IPv4 | head -1 | awk '{ print $NF }'):0
    

    where lan is my Connection-specific DNS Suffix (yours may differ, in which case you should replace it in the command line above).

提交回复
热议问题