Ever since WSL and subsequent major improvements with WSL2 in Windows 10. Running Linux apps in Windows has become a reality increasingly. If you are messing with the command line interface, most of the toolchains are now fully functional with WSL2. However, using Linux as a traditional desktop GUI out-of-the-box WSL2 experience does not allow you to have a GUI. I showed you some ways to enable WSL2 GUI with RDP last year. Now there are better and more native ways that you can run GUI apps with WSL2.
Microsoft introduced WSLg (g, stands for graphic interface) where it enables you to run GUI Linux apps straight from WSL2.
You need Windows 10 Insider Preview to build 21362+ or higher to enable and try this out. And because you want to run GUI apps, depends on the type of GUI application, you need supports from your GPU driver.
If you already have WSL2 installed all you need to do is
wsl --update
Once it’s update updating, you need to restart WSL or simply run
wsl --shutdown
This will restart the WSL service.
Depends on the distro you have installed you can try apps like
sudo apt install gedit -y
To launch gedit GUI editor as an example. Below is a full example demonstrating the power of WSLg.
Under the hood it’s running FreeRDP
Weston leverages FreeRDP to implement its backend RDP Server. FreeRDP is used to encode all communications going from the RDP Server (in Weston) to the RDP Client (mstsc on Windows) according to the RDP protocol specifications. It is also used to decode all traffic coming from the RDP Client into the RDP server.
This means if you want to RDP into WSL2 with WSLg upgrade it would be possible as well. For more details check out Microsoft’s dev blog post here.
“You need Windows 10 Insider Preview to build 21362+ or higher to enable and try this out.”
This build version does not exist for Windows 10 Insider Preview, the latest available is 19044.1237. 21362+ must be a windows 11 preview build