9

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

 3 years ago
source link: https://www.hanselman.com/blog/how-to-run-linux-gui-apps-on-windows-10-with-wsl-and-wslg
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to run Linux GUI apps on Windows 10 with WSL and WSLg
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.

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 Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK