Modern versions of WSL2 can run GUI applications out of the box via WSLg.
- Install desired GUI application:
sudo apt install nautilus -y
- Run it:
nautilus .
If you are getting this error:
libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI3: Screen seems not DRI3 capable
MESA: error: ZINK: failed to choose pdev
libEGL warning: egl: failed to create dri2 screen
Try (answer adapted from microsoft/wslg#1283 (comment)):
ln -sf /mnt/wslg/runtime-dir/wayland* "/run/user/$(id -u)/"
Then re-run:
nautilus .