All of the answers I found online suggest using a complex workflow of installing X server, configuring RDP and connecting to your Linux box in order to run its GUI app. While this works, the approach is at least a few years old. It is no longer the most efficient way of doing it in 2023. Instead, you can use WSLg.
- Using Linux GUI Apps with WSLg - TL;DR version
- Using Linux GUI Apps with WSLg - Full Version
- Getting To This Answer
WSLg is a convenient and efficient solution for running Linux GUI apps on Windows, providing better performance and compatibility than using an X server, but most importantly giving your Linux app a feel of a native Windows application, which can even be launched from the Start Menu.
Using Linux GUI Apps with WSLg - TL;DR version
Update your WSL2 install:
Install your Linux app, for example GIMP:
sudo apt install gimp
Run it from your Start Menu. The shortcut will be automatically placed under your distro’s folder, for example
Ubuntu, same as any program you install in Windows.
You even get the icon on the taskbar:
Using Linux GUI Apps with WSLg - Full Version
Ensure you have the latest version of Windows and WSL: Make sure you’re running Windows 10 version 21364 or later, or Windows 11 with WSL2 enabled.
Update WSL: Open PowerShell with administrative privileges and run the following command to update the WSL kernel:
Restart WSL: WSL needs to be shut down if it was previously running. This ensures your update is applied correctly.
Install a Linux distribution: If you haven’t already, install a Linux distribution, such as Ubuntu, from the Microsoft Store.
Set the version to WSL2: Ensure your Linux distribution is using WSL2 by running the following command in PowerShell:
wsl --set-version Ubuntu 2
Ubuntuwith the name of your installed distribution.
(Optional) Set the default version to WSL2: Although not required, the default version for any Linux you install is v1. If you want v2 on all Linux distros going forward, you need to run the following command before installing the image.
wsl --set-default-version 2
You can list your installed Linux distributions and check their WSL version by entering this command:
wsl -l -v
in PowerShell or Windows Command Prompt.
Install the desired GUI application: Open the Ubuntu terminal in WSL2 and install the desired GUI application. For example, to install GIMP, run:
sudo apt update sudo apt install gimp
Launch the GUI application: With WSLg, any installed Linux GUI apps will automatically appear in your Windows Start menu. You can simply launch GIMP or any other Linux GUI app from there.
Getting To This Answer
Most of the readers are likely to skip this part and it’s totally fine. I have been playing with various AI tools and since this is an interesting technical question with multiple solutions, I decided to ask the most popular chat bots and see how they respond. Here is what I found.
Both ChatGPT and OpenAssistant provided a solution for X server. While correct, better options are available, that are less intimidating for someone with no prior Linux experience.
ChatGPT knew about WSLg solution, but only offered it after I mentioned it.
Phind told me about WSLg solution right away, so it gets the most respect points.
The actual answer I used was from Microsoft’s WSLg Github page, so I already knew the optimal way before asking the chat bots about it.