The Initial Preview of GUI app support is now available for the Windows Subsystem for Linux

Craig Loewen

Craig

A year ago at BUILD 2020 we introduced our goal to bring Linux GUI applications to the Windows Subsystem for Linux (WSL) to run Linux GUI applications. We are proud to announce the first preview of this highly anticipated and open source feature! We’ve given this feature the nickname: “WSLg”. Please check out the video below or keep reading to see what you can use this feature for, how it works, and how to install it.

What can I use GUI application support for?

WSL lets you run a Linux environment, and up until this point has focused on enabling command line tools utilities and applications. GUI app support now lets you use your favorite Linux GUI applications as well. WSL is used in a wide variety of applications, workloads, and use cases, so ultimately, it’s up to you on what you’d like to use GUI app support for. Below, we’ve highlighted some key scenarios to help you fall in love with running applications in a Linux environment.

Use your IDE of choice to develop Linux projects

Visual Studio Code has an amazing experience using VS Code Remote to create a way for you to have a full-fledged Linux IDE directly on your Windows machine, keep extensions and settings across both Windows and different WSL distros (you can view our getting started with VS Code tutorial here. 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 performant manner.

Here’s an example of running gedit and gvim to edit Linux files directly in WSL.

GUI Apps Editor GIf

Run Linux only applications, or Linux specific use cases like testing

You can use this feature to run any GUI application that might only exist in Linux, or to run your own applications or testing in a Linux environment. This could be incredibly useful for developers who want to test their cross-platform app, as they can now run it directly on Windows 10, and then easily inside of Linux without ever needing to change machines or manage a virtual machine.

Let’s look at an example of running TestCafe Studio in WSL to do some web testing from a Microsoft Edge browser running in Linux.

Linux GUI apps testing

Build, test and use Linux applications that use audio or the microphone with built in audio support

Linux GUI applications on WSL will also include out of the box audio and microphone support. This exciting aspect will let your apps play audio cues and utilize the microphone, perfect for building, testing, or using movie players, telecommunication apps, and more.

Here’s an example of using Audacity running on Linux to record some audio and play it back.

Audio Linux GUI apps

Bonus: Leverage WSL’s GPU access to run Linux applications with 3D acceleration

As part of this feature, we have also enabled support for GPU accelerated 3D graphics! Thanks to work that was completed in Mesa 21.0, any applications that are doing complex 3D rendering can leverage OpenGL to accelerate these using the GPU on your Windows 10 machine. This will make some of your more complex applications run smoothly, such as running Gazebo, a robotics simulation tool. This experience will soon be included by default with different WSL distributions, however you can gain access to it right away by following the instructions in this blog post to get the right graphics driver and to ensure your distro has a compatible Mesa version..

Below you can see the Gazebo application simulating a robot exploring a virtual cave, as well as the Rviz application visualizing the camera feed of the robot and its laser field sensor’s output. Thanks to GPU accelerated 3D graphics we can run this demo at 60 FPS!

Image GUIAppsBlogPostDemo GIF4 ROS

How does this feature work?

From the demos above, you might have noticed we didn’t need to start an X server manually. That’s because with this feature we are automatically starting a companion system distro, containing a Wayland, X server, pulse audio server, and everything else needed to make Linux GUI apps communicate with Windows. After you’re finished using GUI applications and terminate your WSL distribution the system distro will automatically end its session as well.

Like with the rest of WSL plumbing, our intention is for this component to be fully managed and seamless for users. Our intentions are for this system distro to be as invisible to the user as possible, and this is why you won’t see this system distro when you run wsl -l -v. Lastly, we’re excited to present that we are using Microsoft’s CBL-Mariner distribution for this system distro! CBL-Mariner is an internal Linux distribution used traditionally for Microsoft’s cloud infrastructure and edge products and services, and we are now extending its use to support GUI apps inside of WSL. You can view the diagram below to see an overall summary of the architecture of this feature.

Image WSLg ArchitectureOverview

For a full in depth view of what we did to make this feature possible and the deep technical details, please view this blog post written by the developers who made this feature possible.

Getting started with this feature

We are starting the rollout of this feature as an initial preview before we fully roll it into the WSL experience. To get started using Linux GUI app support, you’ll need to make sure you’re on Windows 10 Insiders preview build 21364 or higher. If you already have WSL installed, all you need to do is run wsl --update and you’ll be set to use GUI apps. If you don’t have WSL enabled, running wsl --install will install WSLg automatically as part of the initial WSL setup.

You can find the full install instructions at the GitHub repositories’ README: https://github.com/microsoft/wslg . We also highly recommend that you have GPU compute support enabled in WSL for the best performance, please see this section of the install instructions to see how you can ensure that feature is enabled.

Feedback

Please file any technical issues, or feature requests for GUI application support on the WSLg Github repository. For general WSL issues, please file them at the WSL repository. You can also follow up with me on Twitter @craigaloewen and all WSL team members that are on Twitter using this list. Please stay tuned to this blog for more exciting WSL announcements, and we can’t wait to hear what you think about this new feature.

56 comments

Leave a comment

  • Avatar
    Shawn Eary

    Awesome!!! Now, please ask the FSF and Google rename the GNU\Linux background drivers to sometime nicer. MS Windows usually users the word “services” to describe such background drivers.

    Regardless, I’m can’t seem to get completely away from GNU\Linux and go 100% Windows. GNU\Linux is unfortunately “everywhere”. In my TV, on my Ooma, on my no-plan phone (because Microsoft discontinued the Windows Phone…) and I even use GNU\Linux tool and Bourne Again Shell (BASH) and Haskell for work for utilities sometimes. In fact, I have an EMU1212M that won’t work in modern versions of Windows 10 anymore without serious hacks but it works fine in modern versions of GNU\Linux. Of course, Steinberg Cubase and certain games don’t run in GNU\Linux, but yet other old games like Falcon 4 (DX9 I believe) run faster in Steam OS Proton. Go figure.

    An ideal world would be where GNU\Linux background drivers were named services and MS Windows continued to work awesomely with GNU\Linux.

    Thanks for the massive improvement to WSL, I may be able to get rid of cygwin soon. Of course, I’m not sure how well WSL runs in on a VMWare instance… I’ve only used WSL at home on bare metal so far.

    • Avatar
      Gray Marchiori-Simpson

      “please ask the FSF and Google rename the GNU\Linux background drivers to sometime nicer. MS Windows usually users the word ‘services’ to describe such background drivers.”

      Are you referring to “Daemons”? Because if so, this is a Computer Science term derived from a physics thought experiment named after an ancient Greek philosophical concept – and the term has been in use since 1963.

      So, no.

  • Avatar
    David Broadhurst

    I’m on Windows 10 Insider Preview 21364.1 (co_release) and just get the error below whenever I try to run an app (gedit)

    Unable to init server: Could not connect: Connection refused
    
    (gedit:311): Gtk-WARNING **: 12:28:03.122: cannot open display:
  • Avatar
    Jay Mate

    will it eventually be possible to set Linux apps as default for certain windows apps?
    for example, i’d like to be able to set evince as the default application to open PDF documents.

  • Avatar
    Jon Macey

    Just to say I have tested the code I use for teaching my students OpenGL (https://github.com/NCCA/NGL) and it’s mostly working fine 🙂 I can use Qt and OpenGL 4.5 to do realtime PBR demos and loads of other stuff.

    I tried a compute shader demo which works (TBH I thought i wouldn’t work at all!). I can also do Tessellation and Geometry shaders and they work.

    I have a few issues with SDL2 and Qt where the windows events are doing something a little strange, I always map the ESCAPE key to be the quit event and this seems to be getting polled for some reason and quitting my apps! In both cases if I comment out the SDL or Qt Key_Escape event everything is fine (as are all the other keys). I will try and create a minimal example and post a bug report if it continues.

    Thanks for the hard work this is really nice and will make my life easier as I generally develop under Linux and port to windows.

    Jon

    • Avatar
      Jon Macey

      I have tracked down the issue to the keyboard buffers not being flushed and my apps quitting after first run due to the last key event (in my case the escape key) being triggered on the next run! I have posted a bug report on github, apart from that it’s really working well.

      • Steve Pronovost
        Steve PronovostMicrosoft employee

        Thanks Jon for isolating the behavior, creating a small code sample and opening an issue on WSLg. We’ll take a peek at this when we get a chance and see what’s going on there, definitely an odd behavior :-).

  • Avatar
    Parker Reed

    Updated to 21364, enabled WSL and VirtualMachine, installed WSL 2 kernel, installed Ubuntu as suggested by the WSLg readme, and I still get cannot open diaply when trying anything X11. Am I missing something here?

  • Samuel Pichardo
    Samuel Pichardo

    I was already quite happy before this new update as I was able to run a GUI environment via xRDP (https://medium.com/@apph/desktop-gui-using-wsl2-xrdp-a870a2d32df8) , but now this is even better… just remade my WSL2 image and quickly started to use this new feature

    • Able to run Linux-based CUDA code : check
    • Able to run Linux GUI apps: check
    • While keeping running Win desktop : check

    Steve Balmer may be angry as hell…. but man, way to go MS, and so many thanks