Jun 08, 2020
A workaround to share screen on sway with vnc
Sway on Wayland on Archlinux is my current setup for my laptop, with which I mostly code, for work or for fun.
Sway is a great wm to use, but it’s maturing and something is not natively available yet.
One of those things that I was missing is a way to share your screen during web meetings, with chromium, which, on my laptop, runs with XWayland, the X11 compatibility layer.
wayvnc is a software that implements a vnc server for Wayland.
I stumbled across it after reading a workaround for screen sharing in a Sway github issue. A user was proposing to use x11docker to run slack in a container and wayvnc on the host.
Starting from that I looked for wayvnc and get a working setup on my Archlinux machine.
I just installed aml-git, neatvnc-git and wayvnc-git from AUR.
Then you can run
wayvnc 0.0.0.0 to start the vnc server.
Sharing the screen with chromium
I usually use qutebrowser to browse the web (try it, it’s awesome), but for web meetings on Microsoft Teams, Zoom, or Whereby I still use chromium due to the fact that it seems more well supported by those services.
On my laptop chromium runs with the wayland-x11 compatibility layer. For me that means that when I try to share my screen in a web meeting I can select for sharing only the windows from applications running with the x11 backend. If I share the entire screen I get a pith black windows with nothing in it.
To do the trick I start remmina prepended with
That will run remmina with the x11 compatibility layer.
Once launched I can connect with remmina VNC client to localhost
and get a window that shows my screen.
Because that window is on the x11 layer it is detected by chromium and I can share that in the web meeting.