If you want to run a headless sway session on a server and connect to it.

Dependencies

  • sway
  • wayvnc

Server

Start sway with XDG_RUNTIME_DIR=/tmp/ WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 sway

Start wayvnc inside sway: swaymsg --socket /tmp/sway-ipc.*.sock exec 'WAYLAND_DISPLAY=wayland-1 wayvnc -C ~/.config/wayvnc/config 0.0.0.0'

Client

If you've ensured that the server is running and the firewall has an exception for port 22 (or the port your sshd listens on), you can run:

ssh -FL 9901:localhost:5900 <user>@<SERVER_IP> sleep 5; vncviewer localhost:9901