Skip to the content.

Windows 10 WSL 2 with Graphical Applications

Linux uses X11 or Wayland for displaying graphical output.

Windows 11 natively supports GUI Apps from WSL (link). On Windows 10, you will need to install an X server in windows and direct WSL to output to this window.

  1. Install a X11 server on Windows. VcXsrv is a Windows X-server based on the xorg git sources (like xming or cygwin’s xwin). You can download it from https://sourceforge.net/projects/vcxsrv/
  2. Start the X server using XLaunch (multi window, do not start a client, no access control). You may need to allow for security exceptions for VcXSrv to allow the X11 connection from WSL to Windows side (details)
  3. Open up a new WSL shell. You need to open a new shell AFTER the X server is started on windows side. The existance of an X11 server is only checked when shell is started.
  4. Validate that DISPLAY variable is set.
       echo $DISPLAY
    
  5. If DISPLAY variable is not set, then install WSL Utilities which help with the WSL windows integration:
       sudo apt update
       sudo apt install ubuntu-wsl
    

    Add to ~/.bashrc:

       # call Windows Subsystem for Linux integration
       # this sets  DISPLAY variable if X11 server is found on windows side
       source /usr/share/wslu/wsl-integration.sh
    

    This sets the DISPLAY variable automatically when opening a WSL shell if a X server is running on the windows side. So, open up a new shell and try again.

Hint: need a better terminal in windows? Check out Windows Terminal