It’s been a while since my last post about running Linux GUI applications on Windows 10. At that time you had to install an X Server on Windows to make it work. In May 2020 Microsoft proposed its roadmap to bring GUI applications to the Windows Subsystem for Linux and in April this year, a first preview was available. This project is called Windows Subsystem for Linux GUI (WSLg) and its purpose is to enable support for running Linux GUI applications (X11 and Wayland) on Windows in a fully integrated desktop experience. How does this work out? We will see.
How it works, technically
In addition to the user distro, the WSLg introduces a system distro, a containerized Linux environment where the WSLg XServer, Wayland server, and Pulse Audio server are running. Communication sockets for each of these servers are projected into the user distro so client applications can connect to them. The system distro is based on the Microsoft CBL-Mariner Linux. This is a minimal Linux environment, just enough to run the various pieces of WSLg. FreeRDP is used as a backend RDP Server, encoding all communications going from the RDP Server to the RDP Client showing the GUI windows.
How to get it
To get WSLg you’ll need to join the Windows Insider Program and choose the beta or dev channel. This way, the newest Windows Insider Preview build will be installed, containing the WSLg Preview build. As of now you will get the Preview build version 22000.160, also known as … Windows 11. You may run into the problem, that your computer is not eligible for Windows 11 Insider Preview builds and you may get a warning message. The requirements for Windows 11 are relatively high at the moment: TPM 2.0, Secure Boot, and a modern CPU (e.g. Intel Core 8000 or up). Windows then automatically switches you to the Release channel. But in my experience, if you “insist” on staying in the beta channel by selecting it again, you will get the Preview anyway.
If you don’t have WSL already installed, you can run the following command from a command prompt with administrator privileges
wsl --install -d Ubuntu
and then reboot when prompted. If you do have a WSL installation, but not the newest WSL2, you can upgrade with the following command:
How to install and run GUI apps
You can now just install applications using the package manager of your selected distribution. I will use Debian as an example:
sudo apt install x11-apps -y
This will give you xcalc, xclock, xeyes, xedit, and a lot of other stuff.
All app windows appear as separate windows on your desktop.
You will not find many Linux applications which are not also already ported to Windows. Gnome Web is one example, the lightweight standard web browser of the Gnome desktop, or Evolution or Geary. Some software ports may not have reached the same quality or stability on Windows as the original, though. Or maybe you got accustomed to some Linux software and just want to use it under Windows also.
Developing Linux software using WSL is a whole different story, of course. As a software developer, you can now use all GUI-based development tools and you also can develop and test Linux GUI applications. Or Electron-based multiplatform apps. This is very convenient and one of the initial primary reasons for the development of the Windows Subsystem for Linux.
Some more information
WSLg is designed to support OpenGL accelerated rendering by the graphics card. There are already preview drivers available from Intel, AMD, and Nvidia. You can find links to their respective web pages in the link list below. Nvidia and AMD also support machine learning APIs in their drivers.
To create a shortcut to an installed Linux GUI app without using a terminal window, you can use the following “trick”: create a VBScript file, e.g. a file named “xeyes.vbs”, containing this single line:
CreateObject("Wscript.Shell").Run "C:\Windows\System32\wsl.exe -d Debian -e xeyes",0,True
Double-clicking on this file will start the application “xeyes” in the distribution “Debian” without a terminal window.