Screen sharing in Wayland

During the pandemic I quickly realized that screen sharing, a feature crucially important for remote work, was something that didn't work out of the box in Wayland. I was too busy to invest a lot of time into looking into the problem so I just switched to X11 and forgot about it. If you found yourself in a similar situation and haven't figured it out so far, this is for you. When you know what to do, and you're not intimidated by sentences like “you will have to replace pulse-audio with pipewire”, the setup is actually quite straight forward. So here are all the steps involved in getting (full) screen-sharing and even OBS Studio to work on Wayland.

First of all: the usually so infallible ArchWiki let me down this time. They have instructions on how to set up screen sharing on Wayland but it simply doesn't work. I will however point to the Wiki, because it's only missing one – slightly intimidating – step. Replacing pulse-audio with pipewire. But having done that I can assure you: It's smooth as butter! My Bower & Wilkins PX headphones were supported out of the box with the AptX-HD Bluetooth audio codec; something that would require third party plugins with pulse. You won't actually notice any change after switching. Gnome sound settings, pavucontrol and pactl all continue to work like before. So that being said, let's get a move on!

There is a section in the ArchWiki page on Pipewire about WebRTC screen sharing. Follow the instructions there and come back here after having done so. Next, install pipewire-pulse and confirm that you want to replace pulse-audio. You might end up with a file /etc/pipewire/media-session/media-session.conf.pacnew. Make sure to move it to /etc/pipewire/media-session/media-session.conf or you won't find any sound devices. Start and enable the Pipewire sockets: systemctl --user enable --now pipewire{,-pulse}.socket. Give it a shot! Open up https://meet.jit.si and start a screen sharing session (assuming you followed the wiki and set the chrome://flags/#enable-webrtc-pipewire-capturer setting if you're using chrom(e|ium)).

OBS Studio

OBS Studio 27.0 rc2 has Pipewire support! You can install it from source (or the AUR as obs-studio-git). You will need to pass it the command line option --platform wayland, or you won't see the new capture input. Copy /usr/share/applications/com.obsproject.Studio.desktop to ~/.local/share/applications, add the command line option to Exec= and you should be good to go!

Thanks

Thanks to Rasi and hashworks at #archlinux.de for helping me figure most of this stuff out!

#wayland #linux