Skip to content

Instantly share code, notes, and snippets.

@pojntfx
Last active July 15, 2025 01:24
Show Gist options
  • Save pojntfx/32e13d3eda90f34a56913e9fb53e7ac3 to your computer and use it in GitHub Desktop.
Save pojntfx/32e13d3eda90f34a56913e9fb53e7ac3 to your computer and use it in GitHub Desktop.
Forward multiple Wayland applications via a single `waypipe` connection

Extra QEMU arguments to enable headless virgl/hardware accelerated rendering:

-device vhost-vsock-pci,guest-cid=3 -display egl-headless,gl=on

On client:

rm -f /tmp/socket-local; waypipe -s /tmp/socket-local client # TCP
waypipe --vsock -s 2:5000 client # VSock

On remote (change -p 8022 and pojntfx@localhost to match your system):

ssh -p 8022 -R /tmp/socket-remote:/tmp/socket-local -t pojntfx@localhost waypipe --display=0 --unlink-socket -s /tmp/socket-remote server -- bash # TCP
ssh -p 8022 -t pojntfx@localhost waypipe --display=0 --vsock -s 5000 server -- bash # VSock

Now, in any future SSH sessions to your server, you can start graphical Wayland applications like so:

export XDG_SESSION_TYPE=wayland
export WAYLAND_DISPLAY=0
weston-terminal

And they will be rendered on your local system. If you want portals to work too, use:

systemctl --user set-environment WAYLAND_DISPLAY=0
systemctl --user set-environment XDG_SESSION_TYPE=wayland
systemctl --user import-environment WAYLAND_DISPLAY XDG_SESSION_TYPE

# Restart the portal services
systemctl --user restart xdg-desktop-portal.service
systemctl --user restart xdg-desktop-portal-gtk.service

Electron-based apps, e.g. those installed via Flatpak, might need some additional flags, e.g.:

flatpak run com.vscodium.codium --enable-features=UseOzonePlatform --ozone-platform=wayland
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment