Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2795

How to set up DISPLAY variable for WSL2 of ubuntu 20?

$
0
0

I have a WSL2 with ubuntu 20. In most posts, setting up DISPLAY environmental variable to access windows X11 server is made through WSL localhost address in ~/.bashrc

$ export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0

or

$ export DISPLAY=$(cat /etc/resolv.conf |grep nameserver| sed 's/nameserver //'):0

However, these commands will find the WSL2 machine localhost IP that differs from host machine localhost.

For Me, to make xlaunch X11 server works properly, I have to set DISPLAY every time the host localhost IP is changed using cmd ipconfig command.

Is there a way to set DISPLAY to host machine localhost before the start of WSL2. For instance, through windows %USERPROFILE%\.wslconfig file.


Viewing all articles
Browse latest Browse all 2795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>