Requirements
Install these packages in your respective distro:
- xclip
Here are the steps
- Clean up existing x11 file.
rmdir /tmp/.X11-unix && ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
- Create a systemd service
touch /etc/systemd/system/wslg.service
And add the contents:
[Unit]
Description=symlink /tmp/.X11-unix
After=systemd-tmpfiles-setup.service
[Service]
Type=oneshot
ExecStart=rmdir /tmp/.X11-unix
ExecStart=ln -s /mnt/wslg/.X11-unix /tmp/
[Install]
WantedBy=sysinit.target
- Enable the service on startup
systemctl enable --now wslg
Now when you copy a text from the terminal, you should be able to paste it anywhere in the windows host