wsl and VcXsrv (and Cygwin)

Hits: 243

wsl is the Windows Subsystem for Linux, a nice way to get apps from X-Windows to work in MS-Windows.

Here you can see the MS-Windows taskbar and icons in the desktop. The terminal in the foreground is running wsl in one of its tabs, but the tab for Cygwin is the one that is open. The X applications that comprise the other windows are all Cygwin.

The way it is supposed to work, is that I configure and run wsl so that both Windows and Linux kernels cooperate together, and then install VcXsrv so that I have a way of running X applications on Windows through my MS-Windows installation. For the record, I am running Windows 10, and WSL 2.

I am still in the process of learning how to configure it. Above you see a screenshot of my desktop running the apps you would expect to have run on a properly-configured wsl/VcXsrv installation: you see xcalc, xterm, and xload. You even get xfig. In the foreground is Windows Terminal, so that doesn’t count. VcXsrv is running with the root window hidden so you can see my Windows Desktop along with the attendant X-Windows applications.

So what’s the problem, you ask? It looks like I have gotten it do do whatever I need it to do, so there is little else to learn. And that, my dear reader is where you are mistaken. Yes, VcXsrv is running X-Windows as it should, but the applications are coming from my Cygwin installation, not from wsl. Setting $DISPLAY to 127.0.0.1:0.0 in Cygwin is enough configuration in Cygwin to get it to send apps to VcXsrv directly from Windows Terminal, over the BASH command line.

I have been trying for the past week to get this to work in wsl without success, but I appear to be succeeding in running Cygwin’s X apps without Cygwin’s X-windows.

Have I gained anything by stumbling on this? Well, I have to say that the X server offered by VcXsrv is faster than Cygwin/X. Cygwin’s X-windows server takes nearly a minute to load, while VcXsrv loads in under a second. One thing that is lost is the ability to launch X running one of the window managers, like mint, KDE or Gnome. With the X desktop as given under VcXsrv, there are no window commands or menus apart from the one that appears in the Windows 10 taskbar icon tray on the right. It is nearly identical to the Cygwin/X menu.

But as it is, it has no commands, and would work better if it wasn’t there at all. So, yes you can hide the desktop, just like you can under Cygwin, and have your X-apps mingle with your Windows 10 apps. They can all be accessed by using Alt+TAB just like any windows 10 application.

I have noticed that the “top” command does something different under an X-based terminal than it does in a Windows 10 terminal. Apart from the usual information, it shows a text-based bar graph of the usage of each core on the CPU, as well as the memory and swap used.

This is Cygwin’s rxvt window running under Windows 10 and X-Windows. Unlike normal “top” on wsl and Linux generally, this one also uses bars to indicate cpu loads and other information. Color is toggled with a keypress on both OS’s, but color is default on Cygwin.

What are your thoughts?