>> [MUSIC]. >> Hi, my name is Craig Loewen. I'm a Program Manager
working at Microsoft on the Windows Subsystem
for Linux or WSL. I'm here to talk to you-all about the latest
feature coming to WSL, which is support for
Linux GUI applications. This means that
you'll be able to run all visual Linux GUI
apps now with WSL. We're expanding it from
just command line to GUI as well and I'm going to give
you what you can do with it, how works some demos and how it actually all works
behind the scenes as well. Up until now, WSL is focused
just on the command line, but with Linux coming up support, this opens up a whole range of opportunities for
you as a developer. Starting right away
with building your app, you now have access to a
fully Linux-based IDE, so integrated
development environment. If you're very used
to VS Code Remote, that is an awesome way
to interact, build, test, and debug your Linux apps. That same experience now
branches over to other editors. You can use JetBrains-based editors. You can use editors like gedit or GVim and these are all running
fully in a Linux environment, making it a lot easier to debug
and run your Linux applications. As well beyond just developing, you can also use this
for testing with the ability to run browsers now
directly in a Linux environment, you can test exactly how your website would look
and behave on Linux. Lastly, you can run
this just in general, to run Linux apps with things like microphone support as
well as GPU acceleration. This works great with apps
like Udacity, Gazebo, or Blender even to just have easy Linux environment
to run these apps on. When you have GUI app support
enabled on your machine, you can just run any Linux app, basically the same way that
you'd run any Windows app. They're startable
from the start menu, they appear on the taskbar, they're fully interactable windows, and you can use them just
the same that you would use any app to develop tests
or run your applications. A really great example that
I mentioned is using an IDE, so accessing something like, let's say gedit to go and edit your dead top bashrc
file on startup. It's just one of the many
applications that you can use. Personally, I use it when
doing things like Python, and I want to quickly
visualize the data-set, I use Matplotlib and I can
quickly pop that open, even though I'm
debugging and running my application fully
in a Linux instance. Let's jump in and take a look
at how you can actually use WSL GUI apps inside of your
inner Dev loop workflow. I'm going to jump on over to my
laptop that I have here and here, I just have my website running. The first thing that I usually do is open up Code dot to
use VS Code Remote. As I talked about before, I have a full Linux environment
where I can test debug, run my app and you can
really see that by, if I hover over a file, it's ending in a Linux file ending. Using GUI apps, let's
go ahead and edit some of these files using another editor. I'm going to open up a file, the same one that I had open inside
of VS Code Remote using gedit. I'm opening this straight
from the command line. You can see it runs here and this is an actual Linux GUI
app running on Windows. It behaves just like a
regular Windows does. Now if I go and open up
another window like about, you can even see that I have
amazing drop shadow here, just like your normal Windows do. What really gives it away
that this is a Linux app is the tiling at the top and
if I go and open a file, you can see I have a
GTK-based file picker here, which really proves that
this is a Linux app. I can go in and edit, debug and test my file from
here and my whole project. I'm going to run bundle
exec Jekyll serve watch, which is definitely
a tongue twister. I'm going to open this up and here's my website that I'm
debugging and testing. Going back to gedit, I can go in and change these values. Let's say I want to
change this to 00FF00, I go save this, my website automatically
reloads and there we go. I now have a gorgeous bright
green here for my website. Now that I've gone
ahead and run that, we can do other interesting
things like run Thunar. Thunar is a Linux-based File
Explorer and just to really close the loop on why WSL is
awesome is that this is a fully integrated workflow
between Linux and Windows. When I go "Open With,"
you'll actually see in open with
Windows File Explorer, let me move it over so you
can make sure you see it. This is something that I've
created where I basically made a Linux-based a shortcut to a
Windows process of File Explorer. When I click that, I'll open that folder inside of
Windows File Explorer. You can even see the Linux
here showing that we are opening this inside of
our Linux subsystem. That's pretty neat and
pretty mind-blowing on how integrated these are and
really just to close the loop, let's take a look at a test
script that I have here. This uses a tool called playwright, and this is going to test my app using the Linux version of Chrome. I run this and I go open some pages. I'm actually not touching anything because it's running
automated tests on my Linux browser instance to make sure that I'm ready
to go push this life. This is a really basic
example of how you can use GUI apps to go from
A to Z of everything, from writing your
code to testing it, to deploying it, into production. GUI app support also
includes audio support for both hearing and recording using
your microphone on your machine. I have a demo. I can jump on over to my laptop. Here, I'm this folder called audio test and you can see that
I have two files here. This is a Python script
that I found online, where it is basically making a spectrograph using the fast
Fourier transform on your audio. It's showing you what
frequencies the audio coming in from your microphone
is being recorded at. If I go ahead and run this, I get a Matplotlib, which is basically just
a plot of the audio. Then I can see what I'm
saying right now is actually being filtered to
this raw audio signal here. Then a fast Fourier transform is
being done on it here to show what frequencies are most
prevalent in my voice. This is a really cool example of
just how quickly you can use WSLG to get a simple app running that even includes support
for your microphone. We also includes support for GPU
acceleration in Linux GUI apps. That's complicated term, but I
can break it down really easily. It means that we'll actually be leveraging the GPU that you have on your Windows machine to increase performance inside of
your Linux GUI apps. This is for applications that do complex 3D rendering using OpenGL. They can actually leverage GPU-compute support
inside of WSL to make these rendering processes go faster inside of your
Linux instances. The best way to show this off
obviously is with a demo. I'm over here on my terminal window
and I'm going to run Blender. Blender is app that you can use to make basically 3D models of things, animations, and even simulations. I run it here, you can see it
pops up in the start menu. I've created a project called
wrecking ball top blend. From here, I'm going
to pull it back to the beginning and
I'm going to run it. I basically made a simulation of a wrecking ball coming
in and hitting some cubes. This is pretty cool to see and you can actually see that it's
running pretty performantly. When I go back on over
to my task manager view, you can see that the
graphics card that I'm using here is actually having its cycles be used to increase the performance of this
pretty costly simulation. This means that your apps
are going to be performant and work quite well even
for really complex tasks, like rendering a simulation
inside of Linux. Behind the scenes, whenever you
start up your WSL distribution, we now start up a companion
distro called a system distro. What this means is that your actual distro that you're used to where all your
user space binaries are. Whenever you install a GUI app, that's installed in your user distro and inside of the system distro, we have everything necessary to run all of your Linux
GUI app support. That includes an X server, which is an X Wayland server
and a Wayland server. We can run both X11 apps and
Wayland apps as well it includes a pulse audio server to support
all of the audio interfaces. Most interestingly, it also includes a free RDP implementation that goes
and communicates over the RDP, which stands for Remote
Desktop Protocol. It communicates over that RDP
protocol to a Windows RDP client. That's how the actual apps
themselves show up on your screen. I actually have a diagram of what
this fully looks like over here. It looks a little complicated, but really the endpoint
is that in WSL, we have a virtual machine that
is running everything that you need to have or the apps themselves run inside
of your user distro, but all of the nitty-gritty details run in the system distro
and this connects over to an RDP client on Windows to make this
whole process possible. >> Inside of the Windows
Insider Program right now, we actually have some other
awesome WSL features. The first is wsl--install. We made it really
easy to install WSL. It's just one command
line now, wsl--install. You can use this to do
everything to set up WSL, including getting a distro, and even when you
have WSL installed, you can use that command to
install other distros like Debian, Kali Linux, Ubuntu, openSUSE, etc. The other feature that I am
hugely excited for is wsl--mount. This lets you mount disks that are formatted in Linux file
systems directly into WSL. For example, let's say I have another disk on my
machine that is formatted in an ext4 format because I also
like to dual-boot on my machine. I can now mount that disk directly
into WSL and edit those files, making a lot easier to
interact with files that I would be interacting with
normally through dual-booting. >> For this section
of Tabs vs Spaces, I've convinced Craig to do some rapid-fire questions
and answers with me. So we're just going to
jump straight into it. Craig, my first question is, how do I know if my app is
running on Linux or Windows? >> One of the easy ways
we make to identify this is in the taskbar
we put a little Tux, which is a little
penguin like a symbol of Linux icon on the bottom
right of the icon in Linux. That's the easiest
way you can just see that and know right away
that it's running in Linux. >> Will I be able to pin my Linux apps to the Windows
start menu or task menu? >> Yes, you can pin them
right away to start menu. If you hit start, it's under a folder of your
Linux distribution name. For example, if you're in Ubuntu, its under a folder called Ubuntu. You can find all your
Linux apps there and you can pin them right
away to your start menu, just by right-clicking and hitting "Pin to start", like you
would any other app. >> Tell me about the
current compatibility with VirtualBox and VMware. >> In the past on older versions
of VMware and VirtualBox, you haven't been able to
run WSL side-by-side, because both run a Type-1 hypervisor
and they were conflicting. Luckily, on VMware 15.5.5 and
higher and VirtualBox 6 and higher, you can run both WSL and those
products simultaneously. >> Let me ask you
about RAM consumption. Can I limit the amount of
RAM that I'm consuming? >> Yes, you totally can. By default, we allocate
a maximum RAM limit on the WSL 2 VM of 50 percent of
your total RAM on Windows. But you can limit that by or change it to any value you want by editing a.wsl conflict file in your
user profile on Windows. The instructions on how to do this
are on our docs@ak.ms/userdocs. >> Does WSL work well
with Git version control? >> Yes. WSL has awesome integration
with Git version control. You can use it entirely in Linux, or you can actually map
your credentials manager to use the Windows credential manager to basically query if
you're authorized or not, making it really easy to use both your Windows Git and your
Linux Git simultaneously. >> How about Docker? Do Docker containers work with WSL? >> Yes. More good news, Docker Desktop is
integrated with WSL 2. Actually, they now use WSL 2 as their default engine to power
Docker Desktop on Windows. When you're using Docker Desktop, if you're using it right away now, you likely are already
using WSL 2 for that, and you can even use
the same containers inside of Linux as you
are inside of Windows. >> Getting into more of
the GUI apps situation. The Linux GUI apps when
I'm working with them, am I able to cut and paste from a Linux GUI app and
paste it into a Windows app? >> Yes, we have full support for cut and paste inside
of Linux GUI apps. There's other tools
like color filters, which is an accessibility tool to make your whole
screen black and white, for example, or tools like magnifier work with them as well,
which is really exciting. >> Where are my Linux
GUI app stored? >> All of the Linux GUI apps
are actually stored inside of your Linux user space binary. So if you download and install them, they're installed just like any
other app would be inside of WSL. >> Can I access Windows files
from the Linux GUI apps? >> Yes. It's just as easy as using regular WSL to
access those files. All you need to do is go to /mount, and then all of your Windows drives
are there like C, D, E, etc. Go into those, and you can
access and use them fully. >> Is the Windows
GUI app open source? >> Yes. All of WSLg, which is the code name for Linux GUI app support
in WSL is open source. It's available at
github.com/Microsoft/wslg. >> What about as far
as the system distro, what distro is being used there? >> Excitingly, we're actually
using a distro called Mariner, which is a distro that
is built by Microsoft, and so it's user space distro
that's historically being used. For server applications
inside of Azure, we're now extending its use to also support the hosting the server, like the Wayland and X server to support these GUI
apps inside of WSL. >> So WSLg, is that something where I'll need
updates from time to time, and if so, how do I
go about an update? >> As of right now, yeah. You
will need to update WSLg, just like any other program. WSLg is installed via an MSI file. Then once you have it installed, it's automatically updated
using Microsoft update. Just like any other
third party driver is updated in machine when you
hit "Check for updates", so exact same story for WSLg. You can even force a manual
update by typing in wsl --update. >> So much good information
as always, Craig. Thank you for joining
me on Tabs vs Spaces. Running through all of
these rapid-fire questions, showing us demos,
and letting us know about this great new feature of WSL. I hope to have you back again
soon with more exciting news. >> Thanks, Matt.
Thanks for having me, being on Tabs vs Spaces. Obviously, tabs all the way. >> To learn more about
learning Linux, GUI apps, and WSL, go to our documentation
on docs.Microsoft.com, follow Craig on Twitter, check out the Command Line Blog, or check out the open
source WSLg Repo on GitHub. As always, thanks for joining
us on Tabs vs Spaces. Consider subscribing
either via Channel 9 or YouTube for future episodes. It was great to have you, Craig. [MUSIC]