Thursday, April 22, 2021

You can now run Linux apps with GUIs on Windows 10 via WSL

Windows may be the most popular desktop OS, but that doesn’t mean it can do everything. If you want to do something like run a JetBrains Projector server, for instance, you’re going to need a Unix-based system, like Linux. Microsoft introduced Windows Subsystem for Linux (WSL) a while back, which brought support for running Linux apps straight from your Windows installation.

But WSL had some limitations. Version 1 didn’t even use a full Linux kernel, so a lot of applications still didn’t work. Version 2 made a lot of improvements, but something was still missing: GUI application support.

Sure, you could always set up a hacky solution where you install an X server on Windows, mess with some port forwarding, and set up an automatic environment variable in WSL, but that’s a hassle to do, and it doesn’t always work very well.

Enter WSLg.

WSLg: Run Linux apps with GUIs on Windows 10

WSLg is Microsoft’s answer to the Linux GUI issue, and it’s honestly kind of weird. Here’s a fun diagram of how it works, courtesy of Microsoft.

Image WSLg ArchitectureOverview

There’s a lot going on here, but the basic idea is actually pretty similar to the old manual method of setting up your own X server. Instead, though, the X server is running on a parallel WSL instance that’s invisible to the user. Windows then uses a remote desktop protocol to pipe video and audio from that invisible instance to the Windows side. That probably sounds complicated, and it is, but it works.

Microsoft also says that, even through all these layers, Linux apps should be able to take advantage of your GPU, with things like OpenGL passthrough. Currently, this behavior requires a special driver from AMD, Intel, or NVIDIA, but the plan is to bundle it by default in the future.

That future is probably coming in the second half of this year, with Windows 21H2 alongside a big UI overhaul. Craig Loewen, the Program Manager for the Windows Developer Platform, has confirmed on Twitter that GUI support for Linux apps will arrive for all users in the next major Windows release.

Features

Right now, WSLg actually seems to be pretty feature-complete. The claim is that you can have full video and audio support for Linux GUI apps, along with 3D acceleration. And it’s pretty seamless. When a new GUI app is installed in a WSL instance, it even gets added to the start menu, so you can launch it directly. The apps should display under a folder with the same name as the corresponding WSL instance.

Bugs

Of course, this is an early release, and there are some bugs. Personally, when I set it up on one of my laptops, I couldn’t even get any apps to run. I also didn’t get any Start Menu entries for the apps. The team behind this is incredibly responsive, though, and at least the first issue has already been fixed for the next release.

There are also apparently other issues involving copy-paste and broken audio. You can check out the full list of issues over on the WSLg GitHub repository.

Getting Started

So how does one get WSLg? Well currently, the easiest way is to update to the latest Developer Ring version of Windows 10 Insider (build 21364 or later). Once you’ve done that, you can simply run wsl –update in an elevated Command Prompt or PowerShell window, followed by wsl –shutdown.

Then just open a WSL instance and run a Linux app with a GUI. Assuming everything went well, you’ll see your app appear almost like a native Windows app. Otherwise, check through the GitHub issues, or file your own issue if needed.

Resources

For more information on how Linux apps with GUIs are running, be sure to check out the following resources:

Or watch Craig Loewen’s walkthrough and example video:

The post You can now run Linux apps with GUIs on Windows 10 via WSL appeared first on xda-developers.



from xda-developers https://ift.tt/3avy81R
via IFTTT

No comments:

Post a Comment