Different program windows behaving differently in WSL2

displayeclipselinuxwindows-11wsl2

I'm running WSL2 on Windows 11 with a Debian distro. To use GUI apps, I'm running a VcXsrv XLaunch with the Display number set to 0, multiple windows, no start client, not using native opengl, and with access control disabled. For some apps (e.g. Paraview, Firefox) they behave how I would expect them to on a Linux machine: my cursor icon looks GNOME-y, I can make the windows full screen, the taskbar icon is what it's supposed to be.

For other apps, e.g. Eclipse, the window behaves in an odd way: my cursor icon is still GNOME-y, but I can't move the window or make it full screen, and the taskbar icon is a penguin and a smaller penguin. Also worth noting is that Eclipse is run through Java (I think), and also I get an SLF4J error + a GLib-GObject warning when I launch it.

I don't know whether this is a WSL bug, or if I haven't installed the proper display drivers or what, but it's bugging me that different GUI apps are behaving differently. Can anyone explain why this is happening, and/or recommend a fix?

Edit: Attaching screenshots to show what I'm talking about:

Image of Eclipse IDE running via XLaunch on WSL2. Using Darkest Dark theme

Image of Firefox running via XLaunch on WSL2.

The main thing to notice is that, on the top bar, the Eclipse IDE only has an X — it doesn't have the minimize/full screen icons. In fact, I can't even drag around the window, it just takes up the full screen no matter what.

The Firefox window behaves just like any other. It has the close/minimize/full screen icons, and I can drag around the window when it's not in full screen mode.

Below is a screenshot of the icons that pop up on the taskbar:

enter image description here

Firefox uses the regular Firefox icon, while the Eclipse IDE uses the Linux penguin as an icon.

Maybe also worth noting is that I have Firefox installed on my main Windows OS, as well as on WSL.

Best Answer

Windows 11 comes with its own native GUI capability within WSL2 based on the Wayland display server. In the Linux world there are currently two display servers in common use: Wayland, the new shiny thing that is slated for the future of the Linux Desktop, and X11, the original display server inherited from UNIX.

By overriding the X11 DISPLAY variable, you're telling any app that runs on X11 to use your VcXsrv X11 display server, but there is still a Wayland display server on WSL2 that may be used by apps that support it.

Firefox on Ubuntu defaults to using X11 unless you override, so it is using your expected VcXsrv. Your Eclipse install running through Java supports Wayland and is using that by default bypassing your VcXsrv configuration (as indicated by the smaller of the two penguins on the taskbar icon).

The icon for WSL2 GUI Apps using the native Microsoft technology (i.e. by default, not via your own X11 service) is supposed to show whatever icon is configured in the app's .desktop file installed to /usr/share/applications. If there is no icon specified or is no associated .desktop file, then Windows will default to showing a large penguin on the taskbar. All WSL2 GUI Apps using the Microsoft technology show a small penguin to indicate they're running in WSL2 - this is why you have two penguins.

You may choose from two courses of action:

  1. You could use the native WSL2 GUI support for both Wayland and X11 apps, removing your requirement to set the DISPLAY variable, and the requirement to run your own X11 server.
  2. You could ensure that your WSL2 environment does not have the variable WAYLAND_DISPLAY set and carry on using your own X11 setup. You can unset the variable with: unset WAYLAND_DISPLAY in BASH.
Related Question