A Windows computer shown running Linux desktop apps like Liferea, Weather, and GNOME System Monitor. đź…­

WSLg simplifies running Linux desktop apps on Windows

The latest Windows 10 Insider build (21354.1) introduced support for Windows Subsystem for Linux GUI Apps (WSLg). Microsoft Windows can now run Linux desktop apps natively. Let that sink in for a bit.

I was among the first to demonstrate that you could run Linux desktop apps on top of the then newly introduced Windows Subsystem for Linux (WSL). It required significant configuration and involved managing a legacy X11 window server program to host your apps. The effort received huge attention at the time, and has even featured in the Open Source Stories blog from Microsoft. It worked but it didn’t provide a pleasant or performant experience or work environment.

Fast-forward five years, and Microsoft has made it significantly easier to run Linux desktop apps on top of WSL. WSLg transparently manages the setup and lifecycle of a Wayland window server to run your apps. The window server is built on top of Weston, the Wayland reference implementation. The effort is predominantly open-source all the way down to the proprietary Windows kernel.

The app windows integrate seamlessly with the Windows 10 taskbar, task switcher, and task view. Program windows are invisible to window-snap, however. And by seamless, I mean that they sometimes don't have window decorations/borders and can overlap the taskbar. GTK+ apps work flawlessly, but apps that are written in Qt or that use custom window decorations can be just a bit too seamless. It integrates two ways with the clipboard (text only), but lacks IME support. In other words, it’s the exact feature set I expected of WSLg.

Microsoft generates Start menu entries from the Desktop Menu specification files that are installed alongside your Linux programs in WSL. These files typically manage app entries in the various app launchers on Linux. Windows doesn’t map file and protocol associations (e.g. integration with default apps and open with dialogs) from the desktop files. This would be nice, but it’s probably expecting too much integration in this particular instance. These associations in desktop files are centered around content types (“MIME” types). This concept so alien to Windows that I completely understand that they haven’t found a good solution.

As an end-user, all you need to do is to install and run your favorite apps through your Linux terminal app. Open up Ubuntu from the Start menu and run apt install kate. Then you can either run the command directly, e.g. kate ./example.txt, or launch it from the Start menu.

You can also launch Linux apps from the Windows shell, scripts, and custom shortcuts using wslg.exe, the WSLg app launcher. Run it with the --help argument for more details on its usage.

WSL can’t run apps installed via Flatpak or Snap, but it works with apps installed on-metal directly from your distribution’s package repository and AppImages. Flatpak and Snap support is held back by their stricter requirements introduced by advanced Linux kernel features used to power process security sandboxing.

I tested a whole slew of things, expecting to find lots of problems and limitations. What I found was the opposite. Everything just works and it runs fast and stable. Some apps freak out when you screenshot them or pull up the Xbox Game Bar. Video playback in apps and web browsers is okay, and there is no problem running some light games like Extreme Tux Racer.

Experiences the thrills and slopes in Extreme Tux Racer on Linux on Windows but it’s still Linux. It’s all a bit confusing.

I fully expected GNOME System Monitor and KSysGuard (Task Manager equivalents for Linux) to not work. Surely these apps would be digging too deeply into the operating system, right? Both apps work fine and they display all your running Linux apps and background processes. They’re oblivious to Windows processes and don’t account for their memory and processor utilization. The same limitation applies to WSL itself when you explore your process with utilities like htop.

The only real issue I had was with scrolling on my touchpad. Views and documents resist scrolling upwards, and the tiniest nudge downwards scrolls 2000 px instead of the expected 100th of that figure. Scrolling with a mouse works fine. I expect that this issue will get resolved before WSLg is finalized. You can upvote and follow WSLg issue #42 for updates.

So, are graphical Linux applications on the Windows desktop useful? Undoubtedly. Depending on your needs, of course. As a power-user or creative professional, you just got access to thousands of Linux-only apps.

As a web developer, you can now test your webdesigns on Linux without the luxury of the default Windows fonts and font rendering. You can also install epiphany-browser (GNOME Web) and get a fairly up-to-date WebKit browser.

As a game or app developer, you can test many types of programs on Linux and use the same automation infrastructure and hardware you use to test on Windows. You’ll still need Linux running on real hardware for driver and integration testing, but you can still test a baseline of functionality. WSLg may exaggerate performance issues, and make them easier to identify. It won’t be perfect, but it sure will reduce the time and hardware investment required for a developer to quickly test something on Linux.