PunktfunkPunktfunk
Linux desktops

Sway / wlroots

Stream a sway or scroll session through xdg-desktop-portal-wlr, and fix portal routing and black streams.

Stream a sway session, or one on scroll, a sway fork. Install the host first: Arch, Ubuntu or Fedora. On Hyprland, see Hyprland.

What works

  • Each client gets its own headless output at its exact mode. The host captures it straight from the compositor on the GPU where it supports that, or through xdg-desktop-portal-wlr (xdpw). No chooser appears.
  • Keyboard and mouse go in through the wlroots virtual pointer and keyboard protocols.
  • Library launches open on their own workspace on the streamed output.
  • A reconnect inside the keep-alive window gets the same output back; ctl display lists it.

It needs sway 1.8 or newer, or scroll, and xdpw. The host drives the whole video side through swaymsg (scrollmsg on scroll), so other wlroots compositors such as River or dwl can't stream. It finds the running sway on every connect; you don't export SWAYSOCK.

If another portal backend (gtk, gnome) is installed too, route ScreenCast to xdpw in ~/.config/xdg-desktop-portal/sway-portals.conf (scroll-portals.conf on scroll), then run systemctl --user restart xdg-desktop-portal:

[preferred]
default=gtk
org.freedesktop.impl.portal.ScreenCast=wlr

host.env

Nothing is required: the host finds sway on every connect.

Don't set PUNKTFUNK_COMPOSITOR: a pin turns off detection and session following. Every other option is in Configuration.

The host writes its own chooser into ~/.config/xdg-desktop-portal-wlr/config and restarts xdpw when that changes. When the host stops, it puts your previous chooser back.

Start the host

From inside your sway session:

systemctl --user enable --now punktfunk-host
journalctl --user -u punktfunk-host -f    # watch it start and print its fingerprint

Open the web console to pair a client. To serve Moonlight too, see What the unit starts.

Headless session

There is no packaged headless sway session. Log in on the box, or autologin through your display manager, and enable lingering so the host starts at boot: sudo loginctl enable-linger "$USER".

Known limits

  • sway gets far less testing than KDE and GNOME; scroll is untested on real hardware.
  • SDR only: HDR on Linux needs gamescope — see HDR.

Troubleshooting

"swaymsg get_outputs (is the host inside the sway session env — SWAYSOCK?)"

The host found no sway to talk to: it runs outside the session, or the compositor has no sway IPC. Start the host from inside a sway session.

Black stream, and xdpw logs "unsupported cursor mode requested, cancelling"

A host that predates the cursor-mode check asked xdpw for a cursor mode it refuses. Update the host, or switch the client to game mouse mode meanwhile.

More fixes in Troubleshooting.

On this page