Graphical user interface working in WSL under Windows 10

Image Credit: Cygwin logo

Table of Contents

Install Cygwin

Open the URL or and download the Cygwin installer. The installation process can refer to the official instructions or other bloggers1.

Install WSL/Ubuntu

Before installation, make sure that the WSL option in the control panel has been enabled .

Enable wsl option
Enable wsl option

Download Ubuntu in the Microsoft Store of Windows 10 and complete the configuration. If you want, you can install the other Linux distribution, such as OpenSUSE. In this case, only the executed statements will be different.

Then, install XClip and other related X Window utils through following statements.

  sudo apt install xclip
  sudo apt install x11-xserver-utils
  sudo apt install x11-apps

Run X window server through Cygwin

Open Cygwin and execute the following statement, and keep the window run in the background2.

  startxwin -- -listen tcp

Open another Cygwin window, perform the following statement, and then close the window or do something else.

  DISPLAY=:0.0 xhost +

Test in WSL

Set environment parameter DISPLAY3.

  export DISPLAY=:0.0

Test through xeyes or xclock command.

Graphical transfer when connecting to the SSH server remotely

  export DISPLAY={ip.address.???.???}:0.0

Edit this page

Xin Li
Xin Li

Research in areas such as machine learning, deep learning, and artificial intelligence applications, specialize in priority sampling and learning algorithm for non-uniform data and offset data.Learn more

comments powered by Disqus