​How to run Linux desktop apps on Windows

It was only a matter of time. With Ubuntu now running on Windows 10, hackers have started porting Linux desktop and GUI apps to Windows.
Written by Steven Vaughan-Nichols, Senior Contributing Editor

When the news broke that Canonical and Microsoft were bringing Ubuntu to Windows 10, the official reason is that it was all about porting the Bash shell to Windows. I predicted that, while a Linux shell was great, we'd soon see "people trying to port all Linux userspace programs, including desktops, to Windows." I was right.

Linux X Window Apps on Windows 10

Linux desktop apps on Windows 10? We can hack it!

A few days after Windows Subsystem for Linux (WSL) was released, hackers were bringing Linux graphical apps to Ubuntu on Windows.

The first thing you need to do, after installing WSL and Ubuntu, is to add an X Window server to Windows. The one I used was Xming X Server for Windows. Ubuntu on Windows doesn't currently come with a native X server or Ubuntu's own X replacement, Mir. Xming is a Linux cross-compiled server based on the X.org code for Microsoft Windows. It's meant primarily to securely run, via ssh, remote Linux and Unix X Window applications, but it works fine as a local X server as well.

Next, you'll need to get WSL and Ubuntu running. Once up, you must update Ubuntu's Advanced Packaging Tool (APT) repositories. You do this with the Bash shell command:

apt-get update

Since Ubuntu on WSL automatically runs as root, you don't need to add sudo to the command for it to run.

Once the repositories are up to date, you can install a Linux GUI application. I, and others, have chosen to install Firefox. You can try any application that doesn't require support from a specific Linux GUI toolkit such as GTK+, Tck/Tk, or Qt. Of course, you can always try installing these as well and then applications based on them on WSL, but that's getting ahead of ourselves. First, let's walk, then we can run.

To install Firefox run the Bash command:

apt-get install firefox

Once Firefox has been installed you run it with the Bash command:

DISPLAY=:0 firefox

Then, if all's done well, congratulations, you'll be running a Linux desktop app on the Windows desktop.

It probably won't be running well. After all you're running a graphical program on a beta platform that's not meant to run software with a graphical user interface. The results are messy. Firefox crashed quite often on me, and I'm not the only one. The only Linux desktop application I currently have running consistently is the Vim text edtior.

These programs aren't going to be that fast even when they do run. That's because the X server isn't buffering or directly rendering the graphics. The X11 protocol is, after all, a networking protocol for graphics. It's been used for graphics on Unix and Linux for ages, but without help it's not efficient for graphics. Hence, the rise of Wayland as an X Window server replacement.

Canonical, which supports Mir for a display server, in any case, isn't going to help with bringing graphical programs to WSL anytime soon. Dustin Kirkland, a member of Canonical's Ubuntu Product and Strategy executive team, told me that the presence of these unsupported Linux apps goes to show "the power of open source communities!" That said, Kirkland continued, "Canonical and Microsoft are currently focused on the command line and developer tools in Ubuntu on Windows."

So, it will be up to users to bring full Linux desktop apps and eventually Linux desktops to Ubuntu on Windows. It will happen. I have faith in open-source hackers. And, one programmer has already managed to get the xfce Linux desktop running on Windows 10 using cygwin. Getting more Linux graphical programs running on WSL is just a matter of time.

Related Stories:

Editorial standards