Scott Hanselman

How to run Linux GUI apps on Windows 10 with WSL and WSLg

April 21, 2021 Comment on this post [5] Posted in Linux | Win10
Sponsored By

Many folks have installed X servers and X410 on their Windows 10 machines and hacked together very nice X Server set ups with WSL over the years. However, that support is now official and coming to Windows very soon. It's already in Windows 10 Insiders Dev and is in builds 21364 or higher. (Run winver to see what version of Windows you have.)

If you want to try it out, all you have to do is run "wsl --update" from and command line and you're set. If you have 21364 already but you don't have WSL installed, it's even easier to get started now. (Full details on GitHub as the whole thing is open source as well!)

wsl --install -d Ubuntu

The best part of all this is that you just install Linux GUI apps in your distro with apt install like you would already, and they'll show up automatically in the Windows Start Menu!

Linux GUI apps running from Start Menu

Even better, if you have a nice GPU, you can run WSLg on a system with virtual GPU (vGPU) enabled for WSL so you can benefit from hardware accelerated OpenGL rendering. You can find preview driver supporting WSL from each of our partners below.

Here's the Dolphin Emulator running on my Surface Book 3 laptop on the NVidia vGPU at ~60 fps.

Dolphin on WSL under Windows 10 running at 60fps

You can even run Chrome, Edge, or Teams under Linux on Windows 10 with WSLg.

This is more than just X Server support. The community is moving towards Wayland as a simpler X, but there's also Weston to consider as a great compositor to build on. Weston already had a RDP (Remote Desktop Protocol) backend and could use with with FreeRDP. But windows already has Windows Virtual Desktop that uses RDP RAIL (Remote Application Integrated Locally) as well as VAIL (Virtualized Application Integrated Locally) for optimizing transport over VM (local) boundaries vs network ones. There's an amazing blog post on WSLg Architecture here by Steve Pronovost.

diagram-description-automatically-generated

All this means more than just X apps, WSLg works with OpenGL apps and works amazingly on systems with a GPU that supports WDDMv3.0. The preview drivers linked to above will eventually ship in Windows Update automatically when all this is generally available.

Finally, interesting stuff is cooking at Canonical (Ubuntu) with their custom WSL2 specific distro for Ubuntu on Windows! It's in preview for now:

The Ubuntu on Windows Community Preview will only be available through this link to the Microsoft store. You will not be able to find the Community Preview just by searching in the Microsoft Store.

And finally, here's some answers to some of your "ya but you can do THIS?" questions about running Linux GUI apps on Windows 10.

Can you run The Gimp under WSLg?

Yes. Do know that things in WSLg look best under round number DPI scaling. I'm at 200 here. It'll look back at 175% or something fractional unless you explicitly turn on WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=true in your /mnt/c/ProgramData/Microsoft/WSL/.wslgconfig. But trust me, stay with round numbers.

EzndJavUYAErYqb

Can you run Wine (Wine Is Not an Emulator) to run Windows under WSLg under Linux under Windows?

Absolutely. Here I'm running Internet Explorer (after installing Gecko) under Wine under WSL in Ubuntu on Windows. Why not?

EznjLMtVgAA3oeP

How fast is it? Here I'm running Windows 3.1 emulated within Javascript using PCJS under WSLg within Edge for Linux on Windows 10. It's very fast.

EznlBT0VkAIQD3W

Does PulseAudio work?

Totally does. Out of the box. The genius of the architecture is that there's an already setup WSLg System Distro (this means it's more robust and you can't mess up the settings and accidentally break something) that has everything prepped and working.

Conclusion

If you don't like this or you think this is silly to you, then you likely don't have a problem that this solves for you. For me, this just makes my Windows machine an amazing Linux desktop on top of being a great Windows 10 desktop machine, without the overhead or hassle of a Linux VM. WSLg will let you run other IDEs such as gedit, JetBrains based editors, gvim, etc., to test, build, and debug your Linux applications in a high performance manner. You can also run VS Code on Windows like I do and use VS Code Remote to talk to WSL/Linux.

Go read about WSLg and check it out for yourself! Also be sure to check out the work that Pengwin Linux and the folks at Whitewater Foundry are doing as their distro works with WSLg out of the box already!


Sponsor: Build your apps where your customers are. Oracle for Startups delivers enterprise cloud with no lock-in so you can go after any customer — confidently. Learn more.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
April 26, 2021 9:50
I can't believe this wasn't an April 1 post. The WINE inception is just too much. Well done, WSLg team.
April 26, 2021 16:23
At first I was very confused. Your color scheme matches that of the GWSL project and I couldn’t imagine how they would be praising a project that puts them out of business. Anyway, great article. Especially windows => WSL => wine > win3.1. I wonder many people are going to keep old windows software around this way and if this actually drives more WINE development.
April 26, 2021 16:54
One thing that still bothers me about WSL2 development is how slow Git is if you're using any Windows app (except of course for VSCode) to access the code through the shared folder. Let's see if this update can help me with that issue!
April 26, 2021 22:57
Did Teams work for you? I'm on 21364 and Teams shows up in Start Menu, but wouldn't launch (same behavior on different machines).

I can get Edge, Gimp, VS Code to work, but no clipboard support yet (can't copy an image in Windows and past onto Gimp). Edge actually feels> faster in WSL. Overall this is a great experience. The Windows and fonts look tinier they they ought to (per-mon DPI scaling), but I'd expect this sort of stuff to be worked out soon.
April 27, 2021 18:42
Thanks for posting this! I'll need to see if I can pass midi to WSL and then return audio back to Windows.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.