# WSLg — Run Linux GUI Apps on Windows

> Run Linux GUI apps on Windows: WSLg brings Wayland, X11, PulseAudio and GPU acceleration straight into WSL 2 – no manual X server required.

Source: https://www.jpkc.com/db/en/cheatsheets/shell-system/wslg/

<!-- PROSE:intro -->
WSLg (Windows Subsystem for Linux GUI) puts graphical Linux applications straight onto your Windows desktop – without you installing or configuring an X server yourself. Built into WSL 2 on Windows 11 (and recent Windows 10 builds), it combines a Wayland and X11 compositor with PulseAudio and GPU acceleration. Linux apps such as `gedit`, GIMP or Nautilus launch with a single command; `DISPLAY` and `WAYLAND_DISPLAY` are already wired up for you. WSLg is therefore less a single command than a feature – this guide shows you how to set it up, launch GUI apps and fix the usual snags.
<!-- PROSE:intro:end -->

## Setup & Requirements

`wsl --update` — Update WSL to ensure WSLg is included.

```bash
wsl --update
```

`wsl --version` — Check WSLg version (listed as WSLg version).

```bash
wsl --version
```

`echo $DISPLAY` — Verify the DISPLAY variable is set (should be :0).

```bash
echo $DISPLAY
```

`echo $WAYLAND_DISPLAY` — Verify Wayland display is available.

```bash
echo $WAYLAND_DISPLAY
```

## Run GUI Applications

`<app> &` — Launch a Linux GUI app in the background.

```bash
gedit &
```

`nautilus .` — Open the GNOME file manager in the current directory.

```bash
nautilus . &
```

`firefox &` — Launch Linux Firefox (if installed).

```bash
firefox &
```

`gimp &` — Launch GIMP image editor.

```bash
gimp &
```

`xeyes` — Quick test to verify X11 forwarding works.

```bash
sudo apt install x11-apps && xeyes
```

## Install GUI Apps

`sudo apt install <gui-app>` — Install a Linux GUI application.

```bash
sudo apt install gedit nautilus
```

`sudo apt install x11-apps` — Install basic X11 test applications.

```bash
sudo apt install x11-apps
```

`sudo apt install mesa-utils` — Install OpenGL utilities (test GPU acceleration).

```bash
sudo apt install mesa-utils && glxinfo | grep 'OpenGL renderer'
```

## GPU & Audio

`glxinfo | grep 'OpenGL renderer'` — Check which GPU renderer is being used.

```bash
glxinfo | grep 'OpenGL renderer'
```

`glxgears` — Run OpenGL benchmark to test GPU acceleration.

```bash
glxgears
```

`pactl info` — Check PulseAudio connection (audio support).

```bash
pactl info | grep 'Server Name'
```

`speaker-test -t wav -c 2` — Test audio output through WSLg.

```bash
speaker-test -t wav -c 2 -l 1
```

## Troubleshooting

`wsl --shutdown && wsl` — Restart WSL (fixes most WSLg issues).

```bash
wsl --shutdown && wsl
```

`ls /tmp/.X11-unix/` — Verify the X11 socket exists.

```bash
ls -la /tmp/.X11-unix/
```

`ls /mnt/wslg/` — Check if the WSLg mount point exists.

```bash
ls /mnt/wslg/
```

`export DISPLAY=:0` — Manually set DISPLAY if not set automatically.

```bash
export DISPLAY=:0
```

`cat /mnt/wslg/versions.txt` — Show WSLg component versions.

```bash
cat /mnt/wslg/versions.txt
```

<!-- PROSE:outro -->
## Conclusion

WSLg makes the jump from the Linux command line to graphical Linux apps on Windows surprisingly painless: install the app with `apt` and launch it as if you were on a native Linux desktop – Wayland, X11, PulseAudio and GPU acceleration are already in place. Keep WSL current with `wsl --update`, since that is also how WSLg improvements arrive. If an app refuses to start, a `wsl --shutdown` followed by a restart almost always fixes it; for deeper diagnosis, look at `/mnt/wslg/` and the `DISPLAY` and `WAYLAND_DISPLAY` variables. There is little destructive risk here – WSLg is a convenience feature, not a system-altering command.

## Further Reading

- [Microsoft Learn: Run Linux GUI apps with WSL](https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps) – official tutorial for WSLg
- [WSLg on GitHub](https://github.com/microsoft/wslg) – source code, architecture and troubleshooting
<!-- PROSE:outro:end -->

## Related Commands

- [wsl](https://www.jpkc.com/db/en/cheatsheets/shell-system/wsl/) – manage and control the Windows Subsystem for Linux
- [powershell](https://www.jpkc.com/db/en/cheatsheets/shell-system/powershell/) – the Windows shell you launch WSL and WSLg from
- [bash](https://www.jpkc.com/db/en/cheatsheets/shell-system/bash/) – the default shell where you invoke Linux GUI apps

