Skip to content

Instantly share code, notes, and snippets.

@tdcosta100
Last active February 27, 2025 04:57
Show Gist options
  • Save tdcosta100/e28636c216515ca88d1f2e7a2e188912 to your computer and use it in GitHub Desktop.
Save tdcosta100/e28636c216515ca88d1f2e7a2e188912 to your computer and use it in GitHub Desktop.
A tutorial to use GUI in WSL2/WSLg replacing original Xorg by Xwayland, allowing WSL to work like native Linux, including login screen

Full desktop shell in WSL2 using WSLg (XWayland)

Note

If you want to use Wayland in WSLg in a simpler setup, you can try the WSLg (Wayland) tutorial.

In this tutorial, we will setup GUI in WSL2. No additional software outside WSL (like VcXsrv or GWSL) is required. You will find this tutorial very similar to the one that replaces Xorg with Xvnc. Indeed, it's pretty much the same tutorial, with some few changes.

The key component we need to install is the desktop metapackage you want (GNOME, KDE, Xfce, Budgie, etc), and after that, replace the default Xorg by a script that calls Xwayland instead.

For this setup, I will use Ubuntu 24.04, and install GNOME Desktop. Unfortunately older versions of Ubuntu lack some fundamental things, so we cannot reproduce it in older versions (at least not fully). Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the Sample screenshots section for examples.

So let's go. First, we need a working WSL2 installation.

Warning

WSLg may not work as expected, since Wayland sockets are disabled for everyone, and not every app can handle this. But if you want to use Wayland apps natively, you can use the command export XDG_RUNTIME_DIR=$HOME/runtime-dir and then start your WSLg app.

Before going to real business, let's make sure we are updated.

sudo apt update
sudo apt upgrade

You also need to make sure /etc/wsl.conf have the following lines:

[boot]
systemd=true

If not, create/edit this file, add these lines and restart WSL (for example, using wsl.exe --shutdown, then reopening the distro terminal).

Now we are ready to go.

Installing components

Installing GUI

  1. First you select your favorite desktop environment metapackage. Here is a list of the most common metapackages:

    DistroDesktop EnvironmentMetapackage
    UbuntuBudgieubuntu-budgie-desktop (currently very buggy, I don't recommend using it)
    GNOMEubuntu-desktop
    KDEkubuntu-desktop
    Kylinubuntukylin-desktop
    LXDElubuntu-desktop
    MATEubuntu-mate-desktop
    Studioubuntustudio-desktop
    Unityubuntu-unity-desktop
    Xfcexubuntu-desktop
    Ubuntu/DebianCinnamontask-cinnamon-desktop
    GNOMEtask-gnome-desktop
    GNOME Flashbacktask-gnome-flashback-desktop
    KDE Plasmatask-kde-desktop
    LXDEtask-lxde-desktop
    LXQttask-lxqt-desktop
    MATEtask-mate-desktop
    Xfcetask-xfce-desktop
  2. Once you have chosen the metapackage, let's install it. For example, if you choose ubuntu-desktop, the command will be:

    sudo apt install ubuntu-desktop xwayland
    

    This will install the ubuntu-desktop and xwayland (if not already included as dependency for your metapackage). The installation will take a while, so be patient.

  3. If in Ubuntu, you may want to install snap-store. If you don't need it, you can skip this step:

    sudo snap install snap-store
    

Configuring the environment

If you are using Debian, you need to configure the locale (this is not needed in Ubuntu):

echo "LANG=en_US.UTF-8" | sudo tee -a /etc/default/locale

Create and modify services

  1. Now we have everything installed, 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
    
  2. Paste the code below in the editor:

    [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
    
  3. Exit the editor saving the changes to the file.

  4. Let's enable wslg-fix.service:

    sudo systemctl enable wslg-fix.service
    
  5. We also need to remove all references to Wayland, because if not, some apps (gnome-terminal, for example) will open outside the desktop shell. We will edit the [email protected] service:

    sudo systemctl edit [email protected]
    
  6. Paste the code below in the editor:

    [Service]
    ExecStartPost=-/usr/bin/rm -f /run/user/%i/wayland-0 /run/user/%i/wayland-0.lock
    

Warning

Please read the editor instructions about the correct place to position the text cursor before pasting. If you paste the code in the wrong place, it will be discarded.

  1. Exit the editor saving the changes to the file.

  2. Now we will change the default startup target, because if not, a shell window will appear everytime you start your distro (for example, opening a Terminal of your distro in Windows).

    sudo systemctl set-default multi-user.target
    

Replacing default Xorg by XWayland

By default, the display manager call multiple Xorg instances, one for each user session, including the login screen, provided by GDM (if you are using the GDM as your display manager, of course). So we will replace Xorg script by a new version which calls Xwayland instead the classic Xorg. This is the real magic we are trying to do.

  1. First, let's backup the original Xorg script.

    sudo mv /usr/bin/Xorg /usr/bin/Xorg.original
    
  2. Then, we create a new Xorg script.

    sudo nano /usr/bin/Xorg.Xwayland
    
  3. Paste the code below in the editor:

    #!/bin/bash
    for arg do
      shift
      case $arg in
        # Xwayland doesn't support vtxx argument. So we convert to ttyxx instead
        vt*)
          set -- "$@" "${arg//vt/tty}"
          ;;
        # -keeptty is not supported at all by Xwayland
        -keeptty)
          ;;
        # -novtswitch is not supported at all by Xwayland
        -novtswitch)
          ;;
        # other arguments are kept intact
        *)
          set -- "$@" "$arg"
          ;;
      esac
    done
    
    # Check if the runtime dir is present, and create it if not
    if [ ! -d $HOME/runtime-dir ]
    then
     mkdir $HOME/runtime-dir
     ln -s /mnt/wslg/runtime-dir/wayland-0 /mnt/wslg/runtime-dir/wayland-0.lock $HOME/runtime-dir/
    fi
    
    # Point the XDG_RUNTIME_DIR variable to $HOME/runtime-dir
    export XDG_RUNTIME_DIR=$HOME/runtime-dir
    
    # Find an available display number
    for displayNumber in $(seq 1 100)
    do
      [ ! -e /tmp/.X11-unix/X$displayNumber ] && break
    done
    
    # Here you can change or add options to fit your needs
    command=("/usr/bin/Xwayland" ":${displayNumber}" "-geometry" "1920x1080" "-fullscreen" "$@")
    
    systemd-cat -t /usr/bin/Xorg echo "Starting Xwayland:" "${command[@]}"
    
    exec "${command[@]}"
    

    Please note the resolution of the virtual screen. You can change that to fit your needs (1366x768, 3840x2160, etc).

  4. Exit the editor saving the changes.

  5. Finally, we set the correct permissions for the file and create a link to it:

    sudo chmod 0755 /usr/bin/Xorg.Xwayland
    sudo ln -sf Xorg.Xwayland /usr/bin/Xorg
    

Warning

Sometimes, system updates replace Xorg link with the original version. Just repeat this step if this happens, and Xwayland will work again as Xorg replacement.

Configuring the monitor resolution under GDM and GNOME

Currently, one of the annoying things is the resolution of Xwayland. Even with the -geometry switch, GDM and GNOME don't not respect it. Fortunately, this can be overriden by creating a monitors.xml file. Let's do it then.

  1. First, we create it in the current user directory:

    mkdir ~/.config
    nano ~/.config/monitors.xml
    
  2. Paste the code below in the editor (here it is configured for a 1920x1080 resolution, so change it to reflect your resolution if necessary):

    <monitors version="2">
      <configuration>
        <logicalmonitor>
          <x>0</x>
          <y>0</y>
          <scale>1</scale>
          <primary>yes</primary>
          <monitor>
            <monitorspec>
              <connector>XWAYLAND0</connector>
              <vendor>unknown</vendor>
              <product>unknown</product>
              <serial>unknown</serial>
            </monitorspec>
            <mode>
              <width>1920</width>
              <height>1080</height>
              <rate>59.963</rate>
            </mode>
          </monitor>
        </logicalmonitor>
      </configuration>
    </monitors>
  3. Exit the editor saving the changes to the file.

  4. Now let's copy this file to GDM's home directory:

    sudo mkdir /var/lib/gdm3/.config
    sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config/
    
  5. Finally, we set the correct permissions to the monitors.xml of GDM user:

    sudo chown -R gdm:gdm /var/lib/gdm3/.config/
    
  6. Restart WSL using wsl.exe --shutdown, then reopen your distro terminal.

Running your distro with GUI enabled

Now you have everything ready to start. Just do the following command:

sudo systemctl start graphical.target

After a while (usually a few seconds, but it can take more if you don't have a SSD), the login screen must appear.

After logging in, the logged user's desktop must appear. When you log out, the screen will show the login interface again. This applies to GDM (which is the case if you installed Ubuntu Desktop). In GDM, you can change this behavior changing the configuration file like this:

  1. sudo nano /etc/gdm3/custom.conf

  2. Uncomment and edit the following lines:

     AutomaticLoginEnable=true
     AutomaticLogin=[your username without the brackets]
    

Shutting down

One important thing is: once you start your WSL instance, you cannot just stop it. You must perform a standard Linux shutdown. You can do one of the alternatives below:

  • Power off option on GUI menu
  • sudo poweroff

After doing that, you can safely shut down your WSL instance, either by wsl.exe --terminate or wsl.exe --shutdown. Not doing the shutdown process may cause damage to your WSL instance. So be careful.

Troubleshooting

  1. If it doesn't work at first, try to check your journalctl logs:

    journalctl -b -t /usr/lib/gdm3/gdm-x-session -t /usr/bin/Xorg --no-pager
    

    If you are using Debian, then the command is:

    journalctl -b -t /usr/libexec/gdm-x-session -t /usr/bin/Xorg --no-pager
    

    In the output, you must see what command line was generated for Xwayland, and which error messages appear. Of course, even if it works correctly, you can check the logs just to see what is happening, or for debugging.

  2. You must check if the custom Xorg script was not replaced by the default version of it. If it was the case, just repeat the steps of Replacing default Xorg by Xwayland section.

  3. Check if Xorg is your default display server, not Xephyr or Wayland. If it's not, you must change it to have Xorg as your default display server.

  4. If you are using LightDM, you also need to check logs at /var/log/lightdm (you will need to use sudo to cat files in that directory). The Xwayland output will be in the file /var/log/lightdm/x-0.log.

  5. If it still doesn't work, you can try to restart WSL with wsl.exe --shutdown (don't forget to save everything that is unsaved before, because WSL will shut down completely), then open your distro terminal again and repeat the steps of section Running your distro with GUI enabled.

Sample screenshots

GDM

GDM

LightDM (Kubuntu)

LightDM

GNOME

GNOME

KDE (Kubuntu)

KDE

LXDE (Lubuntu)

LXDE

Xfce (Xubuntu)

Xfce

Contributors

Thanks to this guys, whose feedback made this tutorial reach the current level of quality and completeness (and it will be more and more complete as more feedback is given).

@Adhjie
Copy link

Adhjie commented Dec 12, 2024

Works for me, I initially only need the-GUI-version-of* file manager and text editor; but since I'm planning on trying Waydroid, this is the only way to go forward. Thanks for the guide.
Edit:
Wordings

@antonionatusch
Copy link

is there a way to revert this?

@tdcosta100
Copy link
Author

If you mean uninstalling all installed packages, I don't know if it's possible. If you just want it to not do the startup modifications, you need to disable the wslg-fix.service and comment the modifications in the [email protected].

@Adhjie
Copy link

Adhjie commented Dec 20, 2024

So I have successfully installed everything and it's running, I have another fresh install of Ubuntu and since I like how PCManFM-Qt has a mode to run as sudo. (Any other file manager with a safe option to run as sudo instead of doing sudo -H all the time?)

  1. Does LXQt support Wayland or Xwayland?
  2. Should I use LXQt default Display Manager instead of GDM, if so since this tutorial is for GDM. Is it fine to just use GDM with this tutorial step or is there a plan to cover other DMs?
    https://wiki.archlinux.org/title/Display_manager

SDDM — QML-based display manager and successor to KDM; recommended for Plasma and LXQt.

Is this a better solution until your tutorial expanded to cover more DMs and DEs?

  1. Is it fine to install Debian task- DEs on Ubuntu eg task-lxqt-desktop?
    (As in are they backward compatible, since Debian is upstream of Ubuntu?)

Also I haven't checked if waydroid requirements is native Wayland or Xwayland is possible, BRB.

Edit:
Grammars.

Edit 2:

Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the Sample screenshots section for examples.

You said that but aren't, for example, QT-based distro like LXQt & KDE with SDDM work better with their respective display manager. Is it optimal to use different distro with GDM (Gnome Display Manager), since you only covered GDM config as a display manager here?
(I mixed some terms up, I'm mainly still collecting configuration/guide for the Display Manager, for Window Managers and also wayland compositor that support DEs, there aren't that much choice, IG: KDE KWin & Mutter )

@LanceJZ
Copy link

LanceJZ commented Dec 28, 2024

I'm unable to get any audio output on the Ubuntu Desktop. It works when I open the program using WSLg outside of the desktop. I just needed to install PulseAudio into WSL2 to get that to work. Do you know how I can get audio in the Ubuntu Desktop?

@alifeinbits
Copy link

Hi, works perfectly when launched manually in console with sudo systemctl start graphical.target but I'm unable to autorun the graphical version: tried to run sudo systemctl set-default graphical.target but then on reboot it shows the "Oh no! Something has gone wrong." white screen

is it possible to autostart the graphical target on wsl start?

Yes, it is possible to auto-start the graphical environment when you launch WSL, and I can guide you through the steps to achieve that. Here's how you can configure it:

  1. Create a Startup Script
    First, create a script that will start the graphical environment when WSL starts. Open a terminal and create a new script:
sudo nano /usr/local/bin/start-graphical.sh

Add the following content to the script:

#!/bin/bash
sudo systemctl start graphical.target

Save the file (Ctrl+O, Enter) and exit (Ctrl+X).

Make the Script Executable
Make the script executable with the following command:

sudo chmod +x /usr/local/bin/start-graphical.sh

Modify .bashrc to Run the Script on WSL Start
Now, we need to ensure that the script runs every time you start a new WSL session. Open the .bashrc file:
At the end of the file, add this line to execute the script:

/usr/local/bin/start-graphical.sh

To test it, close your WSL terminal and reopen it. The graphical environment should start automatically. You should no longer need to run sudo systemctl start graphical.target manually.

If you'd like to avoid entering your password every time the graphical environment starts, you can configure sudo to not prompt for a password when running systemctl. To do this, edit the sudoers file:

sudo visudo

Add the following line at the end of the file, replacing your_username with your actual WSL username:

your_username ALL=(ALL) NOPASSWD: /bin/systemctl start graphical.target

This setup will ensure that the graphical environment starts automatically when you launch WSL, without the need to manually run the systemctl command or deal with the "Oh no! Something has gone wrong" screen that can occur when setting graphical.target as the default.

Let me know if you encounter any issues!

@jfmherokiller
Copy link

I actually got a version of this script running under archwsl

tho you will need to call /usr/lib/plasma-dbus-run-session-if-needed /usr/bin/startplasma-x11 instead to get it running

@Adhjie
Copy link

Adhjie commented Jan 19, 2025

@jfmherokiller
since this is for gnome, what steps do you change to get plasma KDE? running?
isnt it SDDM instead of Mutter?

edit:
sorry mixed it up, thats LXQt, Kwin for KDe rite?

@kfoxirl
Copy link

kfoxirl commented Jan 19, 2025 via email

@Adhjie
Copy link

Adhjie commented Jan 19, 2025

@kfoxirl
sorry, I meant the guide used GDM as display manager, is it stable and okay to use a display manager other than the default for each DE?
https://wiki.archlinux.org/title/Display_manager
recommended:
eylenburg.github.io/de_comparison.htm

@kfoxirl
Copy link

kfoxirl commented Jan 19, 2025 via email

@shlomoa
Copy link

shlomoa commented Jan 20, 2025

Works like a charm, thanks !!!

@tdcosta100
Copy link
Author

Nice you were able to use SDDM instead GDM. It should work seamlessly, just like GDM.

@Adhjie
Copy link

Adhjie commented Jan 20, 2025

@tdcosta100
Sorry for pinging, but could you add the

dpkg-divert

part by DanaGoyette comment to the main gist?
That part is really useful, because if the system is updated and it came back again, the remote desktop of the DE GUI won't show up.

@tdcosta100
Copy link
Author

I'm sorry I didn't update the tutorial yet, I've been very busy these last weeks. But this is still on my to-do things to update, don't worry, I didn't forget.

@InfiniteBSOD
Copy link

A stupid question but I’m stuck here:
https://gist.github.com/tdcosta100/e28636c216515ca88d1f2e7a2e188912#replacing-default-xorg-by-xwayland

The system can’t find a file called /usr/bin/Xorg.

I’m running Ubuntu 24.04 on WSL2 and followed the previous steps in the guide. Is there something I’ve missed or which is implied?

Thanks!

@kfoxirl
Copy link

kfoxirl commented Jan 22, 2025 via email

@InfiniteBSOD
Copy link

InfiniteBSOD commented Jan 23, 2025

Did you check if it got installed elsewhere? sudo find / -iname xorg 2>/dev/null

Thanks, tried the command but it doesn't find anything.
I am running an offline installation of "Ubuntu 2404.1.24.0" with a kernel of 5.15.167-4 on Windows 10 22H2 (OS Build: 19045.4894).
With "offline" I mean that I downloaded the ".appxbundle" and extracted the ".appx"-file within it, extracted the .appx in turn and put the content of those files on my harddrive.

I am on an airgapped network so that is why.

However when I tried the same command on my machine at home running Windows 11 and Ubuntu 24.04 then the command returned that it found "Xorg".

Hmm.......

Update:

Checked my computer at home:
Ubuntu 24.04.1 running kernel 5.16.167-4
My OS is Windows 11 24H2 (OS Build: 26100.2894)

apt list --installed | grep xorg returns the following:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

xorg-docs-core/noble,now 1:1.7.1-1.2 all [installed,automatic]
xorg-sgml-doctools/noble,now 1:1.11-1.1 all [installed,automatic]
xorg/noble,now 1:7.7+23ubuntu3 amd64 [installed,automatic]
xserver-xorg-core/noble-updates,noble-security,now 2:21.1.12-1ubuntu1.1 amd64 [installed,automatic]
xserver-xorg-input-all/noble,now 1:7.7+23ubuntu3 amd64 [installed,automatic]
xserver-xorg-input-libinput/noble,now 1.4.0-1build1 amd64 [installed,automatic]
xserver-xorg-input-wacom/noble,now 1:1.2.0-1ubuntu2 amd64 [installed,automatic]
xserver-xorg-legacy/noble-updates,noble-security,now 2:21.1.12-1ubuntu1.1 amd64 [installed,automatic]
xserver-xorg-video-all/noble,now 1:7.7+23ubuntu3 amd64 [installed,automatic]
xserver-xorg-video-amdgpu/noble,now 23.0.0-1build1 amd64 [installed,automatic]
xserver-xorg-video-ati/noble,now 1:22.0.0-1build1 amd64 [installed,automatic]
xserver-xorg-video-fbdev/noble,now 1:0.5.0-2build2 amd64 [installed,automatic]
xserver-xorg-video-intel/noble,now 2:2.99.917+git20210115-1build1 amd64 [installed,automatic]
xserver-xorg-video-nouveau/noble,now 1:1.0.17-2build1 amd64 [installed,automatic]
xserver-xorg-video-qxl/noble,now 0.1.6-1build1 amd64 [installed,automatic]
xserver-xorg-video-radeon/noble,now 1:22.0.0-1build1 amd64 [installed,automatic]
xserver-xorg-video-vesa/noble,now 1:2.6.0-1 amd64 [installed,automatic]
xserver-xorg-video-vmware/noble,now 1:13.4.0-1build1 amd64 [installed,automatic]
xserver-xorg/noble,now 1:7.7+23ubuntu3 amd64 [installed,automatic]

sudo find / -iname xorg 2>/dev/null returns the following:

/usr/include/xorg
/usr/bin/Xorg
/usr/share/bug/xorg
/usr/share/lintian/overrides/xorg
/usr/share/doc/xorg
/usr/share/X11/xkb/rules/xorg
/usr/lib/xorg
/usr/lib/xorg/Xorg

Will check the same commands at my computer at work and update.

Update (again):

On my work computer running apt list --installed | grep xorg returns the following:

xorg-docs-core/noble,now 1:1.7.1-1.2 all [installed,automatic]
xorg-sgml-doctools/noble,now 1:1.11-1.1 all [installed,automatic]

I installed "xorg" by apt install xorg and then re-ran apt list --installed | grep xorg which returned:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

xorg-docs-core/noble,now 1:1.7.1-1.2 all [installed,automatic]
xorg-sgml-doctools/noble,now 1:1.11-1.1 all [installed,automatic]
xorg/noble,now 1:7.7+23ubuntu3 amd64 [installed,automatic]
xserver-xorg-core/noble-updates,noble-security,now 2:21.1.12-1ubuntu1.1 amd64 [installed,automatic]
xserver-xorg-input-all/noble,now 1:7.7+23ubuntu3 amd64 [installed,automatic]
xserver-xorg-input-libinput/noble,now 1.4.0-1build1 amd64 [installed,automatic]
xserver-xorg-input-wacom/noble,now 1:1.2.0-1ubuntu2 amd64 [installed,automatic]
xserver-xorg-legacy/noble-updates,noble-security,now 2:21.1.12-1ubuntu1.1 amd64 [installed,automatic]
xserver-xorg-video-all/noble,now 1:7.7+23ubuntu3 amd64 [installed,automatic]
xserver-xorg-video-amdgpu/noble,now 23.0.0-1build1 amd64 [installed,automatic]
xserver-xorg-video-ati/noble,now 1:22.0.0-1build1 amd64 [installed,automatic]
xserver-xorg-video-fbdev/noble,now 1:0.5.0-2build2 amd64 [installed,automatic]
xserver-xorg-video-intel/noble,now 2:2.99.917+git20210115-1build1 amd64 [installed,automatic]
xserver-xorg-video-nouveau/noble,now 1:1.0.17-2build1 amd64 [installed,automatic]
xserver-xorg-video-qxl/noble,now 0.1.6-1build1 amd64 [installed,automatic]
xserver-xorg-video-radeon/noble,now 1:22.0.0-1build1 amd64 [installed,automatic]
xserver-xorg-video-vesa/noble,now 1:2.6.0-1 amd64 [installed,automatic]
xserver-xorg-video-vmware/noble,now 1:13.4.0-1build1 amd64 [installed,automatic]
xserver-xorg/noble,now 1:7.7+23ubuntu3 amd64 [installed,automatic]

so "xorg" wasn't installed, I guess I pulled it as a dependency on my computer at home without reflecting over it.

@Adhjie
Copy link

Adhjie commented Jan 25, 2025

@ tdcosta100
Okay, also sorry for me pinging you. I just need this to be seen by all users, since it's very important. without that everytime anything update Xorg, it'll get overwritten by the original one if not for dpkg-divert.

@veselinoWiktor
Copy link

Hello,

I followed all the steps with brand new installation of the ubuntu distro in wsl, but I when I run sudo systemctl start graphical.target I get black window, when I waited some time the Home folder poped but still black window, and then this lagged window
Screenshot 2025-02-05 122214

@stefanlack
Copy link

stefanlack commented Feb 17, 2025

Very nice! Thank you.

May it be possible to share clipboard (for copy und paste of text) between windows host and ubuntu-vm? I have installed xubuntu / xfce desktop in my wsl and copy-paste is not working.

Second: I just uses only my primary monitor. I have not investigated yet, but it is possible to use a dual monitor setup? This would be wonderfull.

@mwoodpatrick
Copy link

mwoodpatrick commented Feb 17, 2025

Many thanks for creating this, this worked pretty well for me.

I would like to be able to switch between the Ubuntu Wayland desktop and the windows desktop and these commands worked for me:

sudo systemctl isolate graphical.target

sudo systemctl isolate multi-user.target

is there a better way?

I created a couple of aliases:

alias udesk="sudo systemctl isolate graphical.target"

alias wdesk="sudo systemctl isolate multi-user.target"

@jfmherokiller
Copy link

jfmherokiller commented Feb 17, 2025

@jfmherokiller since this is for gnome, what steps do you change to get plasma KDE? running? isnt it SDDM instead of Mutter?

edit: sorry mixed it up, thats LXQt, Kwin for KDe rite?

I believe I used startplasma-x11 or /usr/lib/plasma-dbus-run-session-if-needed /usr/bin/startplasma-wayland

i cant remember which one

@mwoodpatrick
Copy link

On my other laptop I'm getting the error message:

Feb 17 15:44:51 mlwphpenvy360 /usr/libexec/gdm-wayland-session[1515]: dbus-daemon[1515]: [session uid=123 pid=1515] Activated service 'org.freedesktop.systemd1' failed: Process org.freedesktop.systemd1 exited with status 1

Does anyone have any suggestions on how to debug?

@Adhjie
Copy link

Adhjie commented Feb 18, 2025

@stefanlack
Not really cross copy paste between windows and wsl but I use pano clipboard for gnome desktop ubuntu. I copy paste it to a note, and then copy paste the note to a windows folder in /mnt/c/ sampleFolder and vice versa.
I use vscodium in windows and gnome-text-editor in the wsl DE.

I technically could use syncthing for it but i haven't got the time to set it up on Linux. So IDK, if the GUI also maintained or linux only got CLI one.

@mwoodpatrick
Copy link

mwoodpatrick commented Feb 23, 2025

I added this code snippet to my .bashrc to help with copy and paste

if grep -qEi "(Microsoft|WSL)" /proc/version; then
    echo "Running on WSL"
    alias wcopy='/mnt/c/windows/system32/clip.exe'
    alias wpaste='/mnt/c/windows/system32/paste.exe'
else
    echo "Not running on WSL"
fi

clip.exe is installed on windows by default but you need to manually add paste.exe

  1. clip | Microsoft Learn
  2. MS-DOS Commands :: clip (Copy command output to Windows Clipboard)
  3. MS-DOS Commands :: paste (Paste Windows Clipboard to command input)
  4. paste.exe
  5. paste.exe

paste.exe depends on .NET Framework 3.5 (includes .NET 2.0 and 3.0) which windows will install if you don't already have it

@Adhjie
Copy link

Adhjie commented Feb 24, 2025

Does that copy-paste works even with DE that use Wayland?

@mwoodpatrick
Copy link

yes

@Timbo303
Copy link

Im having trouble getting audio to work on apps like waydroid and firefox inside the desktop. Is there is a fix?

@mwoodpatrick
Copy link

Has anyone gotten this to work with NixOS I would love to have this working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment