Guide to screensharing on Sway from Firefox/Chromium
I spent some time trying to get things to work and in the end I decided to compile the instructions in a compact and coherent guide.
- Install Chromium
81.0.4044.122
or later, or Firefox84.0-1
or later. - Install
pipewire
, and if you’re using Chromium,libpipewire02
as well. If you’re using Arch, both packages are available in the official repositories. - Install
xdg-desktop-portal-wlr
. It is available in the official Arch repositories. - If you’re running Firefox, make sure that
MOZ_ENABLE_WAYLAND=1
is set before you start it to make sure it’s running natively. If you’re using Chromium, start it with the following flags, for the same reason:chromium --enable-features=UseOzonePlatform --enable-gpu --ozone-platform=wayland
. - If you’re running Chrome, enable
enable-webrtc-pipewire-capturer
inchrome://flags
. - Make sure that the environment variables
XDG_SESSION_TYPE=wayland
andXDG_CURRENT_DESKTOP=sway
are set and exported - it doesn’t work without them. - From the shell, run:
$ /usr/lib/xdg-desktop-portal -r & /usr/lib/xdg-desktop-portal-wlr
. This will run the former as a background job, so don’t close your shell. - Run your browser.
- Profit, screen sharing should now work (I tested it in both FF and Chromium and it works on discordapp.com). You can also test if it works here.