Getting X11 apps to work in WSL would require a XServer in Windows and X410 is what I am using.
Traditionally, it works through exporting the DISPLAY variable to localhost but in WSL2, connecting to loopback address is not yet supported.
Thus, we have to
- Allow X410 to be connected from anywhere
- Setup the DISPLAY variable with host IP address
Details for the above are as follows,
Enable public access in X410
- Right click on the icon in taskbar and select “Allow Public Access”.
- You would be prompted with a Windows Security Alert asking for permission. Make sure you selected “Public networks”
- Check if connection success with
nc -v 172.30.32.1 6000
Setup the DISPLAY variable
Put the following command in .bashrc
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
Find the details instruction from this blog