·5 min read·#wsl2#wslg#linux#windows#gui

WSL2 GUI Guide Part 1: Running Linux Apps with WSLg

WSL2 GUI Guide Part 1: Running Linux Apps with WSLg architecture diagram

If you're running WSL2 on a reasonably up-to-date Windows machine, you can probably run Linux GUI applications right now without installing anything extra. No X server, no configuration files, no port forwarding. Just install a Linux app and run it.

This is WSLg—Windows Subsystem for Linux GUI—and it's been quietly shipping with Windows since 2021. Most people don't even know it's there.

Do You Have WSLg?

Open PowerShell and check:

powershell
wsl --version

You should see something like:

WSL version: 2.6.3.0 Kernel version: 6.6.87.2-1 WSLg version: 1.0.71

If you see a WSLg version listed, you're ready. If not, update WSL:

powershell
wsl --update wsl --shutdown

Windows Version Requirements

Windows 11: Build 22000 or later (any Windows 11 release works)

Windows 10: Build 19044 or later (version 21H2 or 22H2)

Important for 2025+: Windows 10 mainstream support ended in October 2025. Continued updates require enrollment in Microsoft's Extended Security Updates (ESU) program. If you're still on Windows 10, consider using the Microsoft Store version of WSL for the latest features.

For the best experience, install WSL from the Microsoft Store rather than using the built-in Windows component. The Store version updates independently and always has the latest WSLg.

Test It Out

Inside your WSL distro, install some GUI apps:

bash
sudo apt update sudo apt install x11-apps gedit -y

Now run them:

bash
xclock & gedit &

Linux windows should appear on your Windows desktop with their own taskbar entries. That's it—no configuration needed.

How WSLg Actually Works

WSLg isn't just an X server bolted onto Windows. Microsoft built something more sophisticated that uses technology Windows already understands deeply: RDP.

Here's the high-level flow:

wsl2-gui-part1-wslg/wslg-data-flow diagram

When you launch a Linux GUI app, it doesn't talk directly to Windows. Instead:

  1. Your app connects to a Wayland compositor running in a separate system distro
  2. The compositor renders frames and streams them to Windows using RDP
  3. Windows displays each app as a native-looking window

The clever bit is using RDP internally. It's a protocol Windows has supported for decades, with mature clipboard sharing, audio passthrough, and GPU acceleration.

Inside the System Distro

Every WSL2 user distro is paired with a hidden system distro based on Microsoft's CBL-Mariner Linux. This system distro runs the WSLg components:

wsl2-gui-part1-wslg/wslg-internals diagram
Click to expand
1526 × 348px

Tip: You can shell into the WSL system distro if you like - use wsl --system

WSLGd is the init process that launches everything: Weston (the Wayland compositor), XWayland (for older X11 apps), and PulseAudio (for sound). It also establishes the RDP connection by launching mstsc.exe in silent mode on the Windows side.

Weston is the Wayland project's reference compositor. Microsoft extended its RDP backend to support RAIL (Remote Application Integrated Locally) and VAIL (Virtualized Application Integrated Locally) modes — these let individual app windows be remoted rather than an entire desktop.

XWayland handles legacy X11 applications by translating X11 protocol calls to Wayland. Most Linux GUI apps still use X11, so this compatibility layer is essential.

The RDP connection stays active in the background, ready to display new apps instantly without connection delays.

Wayland vs X11 Apps

Modern Linux apps using GTK4, Qt 6, or other current toolkits typically support Wayland natively. Older apps using X11 go through XWayland, which adds a small translation overhead but works transparently.

You can check what an app is using:

bash
# For GTK apps GDK_BACKEND=wayland gedit & # Force Wayland GDK_BACKEND=x11 gedit & # Force X11

In practice, you rarely need to care—WSLg handles both automatically.

Audio Works Too

WSLg includes PulseAudio, routing Linux audio through the same RDP channel to your Windows speakers:

bash
# Test audio sudo apt install mpv sound-theme-freedesktop -y mpv /usr/share/sounds/freedesktop/stereo/complete.oga

Audio, clipboard sharing, and even GPU acceleration all work through RDP. No separate configuration needed.

Check Audio Status

bash
sudo apt install pulseaudio-utils -y pactl info

If audio isn't working, a WSL restart usually fixes it:

powershell
wsl --shutdown

GPU Acceleration

WSLg can use your Windows GPU for accelerated rendering. This happens automatically if you have recent GPU drivers installed.

Performance note: On discrete GPUs, there's overhead from copying rendered frames between VRAM and system memory. At very high frame rates (think 600fps in benchmarks), this overhead can reach 50%. For normal application use, you won't notice it.

Check if GPU acceleration is working:

bash
sudo apt install mesa-utils -y glxinfo | grep "OpenGL renderer"

You should see your GPU name. If you see "llvmpipe", that's software rendering — fine for most apps like text editors and file managers, but 3D-heavy applications will be slower.

Update GPU Drivers

If you have a GPU but see llvmpipe, or experience graphical glitches, update your drivers:

Environment Variables

WSLg automatically sets these in your distro:

VariableValuePurpose
DISPLAY:0X11 display server
WAYLAND_DISPLAYwayland-0Wayland compositor
PULSE_SERVER/mnt/wslg/PulseServerAudio server

If you've set custom values for these (perhaps from an older X server setup), WSLg will overwrite them. Remove any manual DISPLAY exports from your .bashrc if you're using WSLg.

When WSLg Isn't Enough

WSLg is optimised for running individual applications. Each app gets its own window on your Windows desktop, managed by Windows.

But what if you want:

  • A full Linux desktop with panels, system tray, and window management?
  • Multiple apps sharing a cohesive desktop environment?
  • GNOME, KDE, or XFCE as your workspace?

For that, you need a different approach: running a complete desktop environment via XRDP. That's covered in Part 2: Ubuntu Desktop with XRDP.

Quick Reference

bash
# Check WSLg is available wsl --version # Update WSL wsl --update && wsl --shutdown # Install GUI apps sudo apt update sudo apt install x11-apps gedit -y # Test GUI xclock & # Test audio sudo apt install pulseaudio-utils -y pactl info # Check GPU acceleration sudo apt install mesa-utils -y glxinfo | grep "OpenGL renderer" # Fix display issues - restart WSL wsl --shutdown

This Series

Further Reading

← Back to all posts