Skip to content

Instantly share code, notes, and snippets.

@tdcosta100
Last active October 22, 2025 22:34
Show Gist options
  • Save tdcosta100/7def60bccc8ae32cf9cacb41064b1c0f to your computer and use it in GitHub Desktop.
Save tdcosta100/7def60bccc8ae32cf9cacb41064b1c0f to your computer and use it in GitHub Desktop.

Revisions

  1. tdcosta100 revised this gist Aug 3, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions WSL2GUIWSLg-Wayland-en.md
    Original file line number Diff line number Diff line change
    @@ -146,6 +146,7 @@ In this tutorial, we will install and use a full GNOME Desktop environment in WS
    DESKTOP_SESSION=ubuntu \
    GDMSESSION=ubuntu \
    GNOME_SHELL_SESSION_MODE=ubuntu \
    GTK_IM_MODULE=ibus \
    GTK_MODULES=gail:atk-bridge \
    IM_CONFIG_CHECK_ENV=1 \
    IM_CONFIG_PHASE=1 \
  2. tdcosta100 revised this gist Jul 28, 2024. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions WSL2GUIWSLg-Wayland-en.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    # Full desktop shell in WSL2 using WSLg (Wayland)

    > [!NOTE]
    > If you want a more complete experience and already tried the Xvnc tutorial, maybe you should try the [WSLg (Xwayland)](../e28636c216515ca88d1f2e7a2e188912) instead.
    > [!WARNING]
    > This is a work in progress tutorial. Things done here may break existing functionality, so be careful!
  3. tdcosta100 revised this gist Jul 28, 2024. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions WSL2GUIWSLg-Wayland-en.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,12 @@
    In this tutorial, we will install and use a full GNOME Desktop environment in WSL2, without any external software. The only requirement is a [working WSLg installation](https://github.com/microsoft/wslg?tab=readme-ov-file#install-instructions-fresh-install---no-prior-wsl-installation). At the moment, the instructions are only for Ubuntu (20.04, 22.04 and 24.04) distros and GNOME, but you can request me to test other distros and desktop environments.

    ## Current limitations

    - No fullscreen support
    - No complete desktop support (with Display Manager)
    - No support to clipboard (copy & paste) from/to Windows

    ## Ubuntu

    ### GNOME
  4. tdcosta100 renamed this gist Jul 28, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. tdcosta100 revised this gist Jul 28, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIWSLg-en.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Full desktop shell in WSL2 using WSLg
    # Full desktop shell in WSL2 using WSLg (Wayland)

    > [!WARNING]
    > This is a work in progress tutorial. Things done here may break existing functionality, so be careful!
  6. tdcosta100 revised this gist Jul 28, 2024. No changes.
  7. tdcosta100 revised this gist Jul 9, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions WSL2GUIWSLg-en.md
    Original file line number Diff line number Diff line change
    @@ -121,10 +121,10 @@ In this tutorial, we will install and use a full GNOME Desktop environment in WS

    1. Save the file and close the editor. Then close the distro terminal window.

    1. Finally we will shutdown WSL. Open a new `Windows PowerShell` or `Command Prompt` window, then do the following command.
    1. Finally we will shutdown WSL.

    ```
    wsl --shutdown
    wsl.exe --shutdown
    ```

    The configuration is complete.
  8. tdcosta100 created this gist Jul 3, 2024.
    165 changes: 165 additions & 0 deletions WSL2GUIWSLg-en.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,165 @@
    # Full desktop shell in WSL2 using WSLg

    > [!WARNING]
    > This is a work in progress tutorial. Things done here may break existing functionality, so be careful!
    In this tutorial, we will install and use a full GNOME Desktop environment in WSL2, without any external software. The only requirement is a [working WSLg installation](https://github.com/microsoft/wslg?tab=readme-ov-file#install-instructions-fresh-install---no-prior-wsl-installation). At the moment, the instructions are only for Ubuntu (20.04, 22.04 and 24.04) distros and GNOME, but you can request me to test other distros and desktop environments.

    ## Ubuntu

    ### GNOME

    #### Installing the required packages

    1. Open a Ubuntu (20.04, 22.04 or 24.04) terminal. First of all, we need to make sure everything is up to date.

    ```
    sudo apt update
    sudo apt upgrade
    ```

    1. WSL doesn't install the app store by default, so we can install it manually (or you can skip this step if you don't need it).

    ```
    sudo snap install snap-store
    ```

    1. Now we can install the required packages. This may take a long time, so be patient.

    ##### For Ubuntu 20.04 and Ubuntu 22.04

    ```
    sudo apt install ubuntu-desktop acpi-support-
    ```

    ##### For Ubuntu 24.04

    ```
    sudo apt install ubuntu-desktop
    ```

    > [!IMPORTANT]
    > Note the minus sign (-) after the package `acpi-support`. This is necessary because it will be installed by default and installing it will render your distro almost unusable (see microsoft/WSL#10059), so we will tell `apt` to not install it.
    #### Configuring the environment

    1. Now we have everything installed, we must configure some things before using the GNOME Shell. First, we need to deactivate the GDM service, because unfortunately it doesn't work with WSLg yet (at least I didn't figure it out how to make it work).

    ```
    sudo systemctl mask gdm.service
    ```

    1. Now we need to fix the directory `/tmp/.X11-unix/`, because it's mounted as read-only by default. We will create a new `systemd` unit.

    ```
    sudo systemctl edit --full --force wslg-fix.service
    ```

    1. Paste the code below in the editor.

    ##### For Ubuntu 20.04 and Ubuntu 22.04

    ```
    [Service]
    Type=oneshot
    ExecStart=-/usr/bin/umount /tmp/.X11-unix
    ExecStart=/usr/bin/rm -rf /tmp/.X11-unix
    ExecStart=/usr/bin/mkdir /tmp/.X11-unix
    ExecStart=/usr/bin/chmod 1777 /tmp/.X11-unix
    ExecStart=/usr/bin/ln -s /mnt/wslg/.X11-unix/X0 /tmp/.X11-unix/X0
    [Install]
    WantedBy=multi-user.target
    ```

    ##### For Ubuntu 24.04

    ```
    [Service]
    Type=oneshot
    ExecStart=-/usr/bin/umount /tmp/.X11-unix
    ExecStart=/usr/bin/rm -rf /tmp/.X11-unix
    ExecStart=/usr/bin/mkdir /tmp/.X11-unix
    ExecStart=/usr/bin/chmod 1777 /tmp/.X11-unix
    ExecStart=/usr/bin/ln -s /mnt/wslg/.X11-unix/X0 /tmp/.X11-unix/X0
    ExecStart=/usr/bin/chmod 0777 /mnt/wslg/runtime-dir
    ExecStart=/usr/bin/chmod 0666 /mnt/wslg/runtime-dir/wayland-0.lock
    [Install]
    WantedBy=multi-user.target
    ```

    1. Save the file and close the editor. Now we have to enable this service.

    ```
    sudo systemctl enable wslg-fix.service
    ```

    1. The last step is to configure the GNOME Shell to start in nested mode.

    ##### For Ubuntu 20.04

    ```
    sudo mkdir /etc/systemd/user/gnome-shell-wayland.service.d/
    sudo nano /etc/systemd/user/gnome-shell-wayland.service.d/override.conf
    ```

    ##### For Ubuntu 22.04 and Ubuntu 24.04

    ```
    sudo mkdir /etc/systemd/user/[email protected]/
    sudo nano /etc/systemd/user/[email protected]/override.conf
    ```

    1. Paste the code below in the editor.

    ```
    [Service]
    ExecStart=
    ExecStart=/usr/bin/gnome-shell --nested
    ```

    1. Save the file and close the editor. Then close the distro terminal window.

    1. Finally we will shutdown WSL. Open a new `Windows PowerShell` or `Command Prompt` window, then do the following command.

    ```
    wsl --shutdown
    ```

    The configuration is complete.

    #### Starting the GNOME Shell

    1. Now open again your distro terminal, then paste the command below.

    ```
    DESKTOP_SESSION=ubuntu \
    GDMSESSION=ubuntu \
    GNOME_SHELL_SESSION_MODE=ubuntu \
    GTK_MODULES=gail:atk-bridge \
    IM_CONFIG_CHECK_ENV=1 \
    IM_CONFIG_PHASE=1 \
    QT_ACCESSIBILITY=1 \
    QT_IM_MODULE=ibus \
    XDG_CURRENT_DESKTOP=ubuntu:GNOME \
    XDG_DATA_DIRS=/usr/share/ubuntu:$XDG_DATA_DIRS \
    XDG_SESSION_TYPE=wayland \
    XMODIFIERS=@im=ibus \
    MUTTER_DEBUG_DUMMY_MODE_SPECS=1366x768 \
    gnome-session
    ```

    1. A GNOME Shell window will appear.

    ##### Ubuntu 20.04

    ![GNOME Shell on Ubuntu 20.04](https://gist.github.com/assets/708549/422f42de-d9ad-4a3e-aede-aeca63962e0f)

    ##### Ubuntu 22.04

    ![GNOME Shell on Ubuntu 22.04](https://gist.github.com/assets/708549/bfb88086-5312-48a0-90c5-5b536e6d23c8)

    ##### Ubuntu 24.04

    ![GNOME Shell on Ubuntu 24.04](https://gist.github.com/assets/708549/735e47a3-0ce2-472d-bb1e-6a15c74df1fe)