Since the introduction of the Windows Subsystem for Linux in 2016 I have dabbled on and off with getting it running, driven mainly by an interest in open source CFD software and the lack of Windows support for these programs. I was also always apprehensive about setting up a dual boot system and figured, correctly, that WSL would be the perfect way to get a comfortable introduction to Linux and working in the shell.
I now have WSL set up on both my home and work Windows computers, and I dual boot my home computer with Fedora on a second SSD. I am much more comfortable working in a command line interface; working in WSL has lead me to discover tools in the Windows Command Prompt which I now prefer to the GUI applications. I now understand why there is so much hate for the Windows Command Prompt, and I understand why decided to Microsoft include the Windows Subsystem for Linux given the power and simplicity of the tools available on a basic Linux installation. For example: Accessing my seedbox via SSH was overly complicated using Putty compared to: ssh user@server.site.com
and my password on WSL. As a lifelong Windows user this simplicity still shocks me sometimes.
Several years ago I tried to get WSL to display graphical applications with Xming but I gave up after terrible performance and scaling issues. I have not tried Xming since so I cannot say anything about the current performance. I replaced Xming with VcXsrv, with which I have had no problems. It even supports copy and paste between Windows and applications rendered with VcXsrv.
The VcXsrv application needs to be installed on the Windows system and running before you can export the display. Upon running VcXsrv you are presented with a Display settings dialogue box and you have four options; Multiple windows(selected by default), One large window, Full screen, and One Window without titlebar. I usually use the Multiple windows option to display individual application windows which I can use in conjunction with Windows applications. The default settings are fine for the rest of the set up.
After VcXsrv is running on the Windows system, open your WSL shell (note WSL can be running during the set up of VcXsrv). You can type export DISPLAY=:0
directly into the shell to get the display to export to the VcXsrv server. To make this setting permanent you need to edit your .bashrc file. I am using Ubuntu 18.04 with the default bash shell, if you are using another shell, you will have to edit that config file.
Using nano (or another text editor) edit the .bashrc file found in your home directory.
nano ~/.bashrc
At the end of the file add the lines:
# For XWindow System
export DISPLAY=:0
# For OpenGL acceleration
export LIBGL_ALWAYS_INDIRECT=1
Exit your text editor and type source .bashrc
to reload bash.
Now you should be able to start graphical applications on WSL. To test it out I would suggest getting another terminal emulator such as Tilix or Alacritty. I use Tilix with the solarized colour scheme shown below. You can start Tilix from the default Windows shell window
While exploring the other options on the VcXsrv Display settings dialogue I found that using the One large windows option allowed me to set a wallpaper on the X server window using Nitrogen as a wallpaper manager. I have also seen examples of people getting desktop environments running using this X server implementation, which makes me wonder if I can install a window manager and theme the applications as I do on my actual Linux desktop.