Skip to main content

WSL and X11 applications


I have been using the Windows Subsystem for Linux for a long time now and have been pretty pleased with it for text-based applications. When I need to use a graphical application, I fire up Hyper-V with a full Ubuntu install, and mount my local drives to access my directories and files. The heavy-handed solution worked well for a long time now, but over time I found I was installing the same set of programs I used frequently in both places. There must be a better solution. If only I could run graphical applications on WSL.

Turns out there is a way.  I searched for a free X11 server that I can install on Windows 10 and found a couple that were highly rated. I also remembered that when I used Cygwin long time ago, it came with its own X-server, and wondered if I can install that separately, since with WSL I did not need Cygwin as a whole. It did, and I installed Cygwin/X server and fonts.
After the install, I ran Xlaunch, which ran a configuration wizard to start the X-server. I passed the extra parameter

-listen tcp

to the server to allow for remote connections from WSL. In the bash prompt, I exported the display

Export DISPLAY=:0.0

and tested the install by running xterm. Viola, I can run graphical applications now on WSL, and I don’t need to duplicate Linux program installs between WSL and Hyper-V.

Comments