In Windows 11, WSLg is automatically activated when you install WSL. Unlike X410 which is an X-Window server, WSLg is a Wayland server. However, WSLg also has a compatibility layer for supporting X-Window client programs. The following post summarizes the differences between X410 and WSLg:

X410 vs. WSLg

If you want to disable WSLg and simply use X410, you can follow the steps described below:

Create a .wslconfig file in your Windows home folder

Your Windows home folder is usually at 'C:\Users\<Your-Windows-User-Name>'. You should also be able to open your Windows home folder by entering %USERPROFILE% to Windows File Explorer.

Add the following lines to .wslconfig

[wsl2]
guiApplications=false





Shutdown WSL

You can shutdown WSL by entering the following command from PowerShell or Windows Command Prompt:

wsl --shutdown


When you re-open your WSL distro terminal, WSLg should no longer be active; you will not see any environment variable related to WSLg (ex. WAYLAND_DISPLAY, DISPLAY or etc.).

Once WSLg is disabled, you can set up the DISPLAY environment variable for X410 as mentioned in the following post:

Using X410 with WSL2

Using WSLg and X410 together

As mentioned above, WSLg is a Wayland server in its core. Hence you can actually run both WSLg and X410. In such case, you can simply set the DISPLAY environment variable to X410 instead of WSLg.

For some GTK based X-Window client programs, you may also need to set the GDK_BACKEND environment variable to x11; some of those programs get confused when both DISPLAY and WAYLAND_DISPLAY environment variables are set.

export GDK_BACKEND=x11




Please note that if you're using an intermediate Unix socket for relaying X-Window data to X410, you may also need to adjust its display number as WLSg creates its own Unix socket in the same directory, i.e., /tmp/.X11-unix/.

For example, if you're using the Option 1 method for VSOCK connections in WSL2 as described in the following post, you need to adjust the display number it uses:

Using X410 with WSL2 » VSOCK

In the above guide, socat is created for the display number 0. However, when WSLg is enabled, it also creates a Unix socket for the same display number and provides a compatibility mode for X-Window apps. You can avoid such conflicts by changing the display number for socat. As shown below, you can change X0 to X1 for the display number 1, X2 for the display number 2 and so forth.

socat ... /tmp/.X11-unix/X1 ...


Once the display number for socat is changed, you also need to adjust the DISPLAY environment variable accordingly. For example, if you changed the display number to 1, the DISPLAY environment variable should also be set to :1.0.

export DISPLAY=:1.0


Share This Story, Choose Your Platform!