Some people suggested that I could use it through Remote Desktop Connection, but I want it to be integrated with the system.
While there are multiple options for running GUI apps under WSL, the only one that is "integrated with the system" is WSLg. While you don't mention which Windows version you are using, it would appear from the second error that you are probably running Windows 10.
WSL on Windows 11 introduced a new feature called WSLg that provides a Wayland/Weston/Xwayland distribution to enable running GUI apps directly on the Windows desktop. Ironically, however, it does use the Remote Desktop Protocol (with extensions) behind the scenes to do this.
With the release of the WSL application (which is installed from the Microsoft Store), WSLg is now available to Windows 10 users as well, as long as your build number ends in
.2311 or higher. This should include 19042.2311, 19043.2311, 19044.2311, and 19045.2311 (Windows 10 22H2), but has only been confirmed at this point on 22H2. Currently, you'll need the KB5020030 optional Preview update for Windows 10. Make sure that your Windows 10 system is up-to-date, then proceed to Optional Updates, and KB5020030 should be available for installation.
Both Windows 10 and Windows 11 users should then be able to install or update via:
# or, if already installed
# confirm 1.0.0 or later via:
There are two other possible ways to run GUI apps in WSL, other than WSLg:
xrdp as I mention in this answer. This can be a better option when running a Linux desktop such as Gnome or Xfce4.
- A third-party XServer as in this answer.