33

How is the status of screen sharing on Wayland? Recently this has become an essential topic for people who telecommute.

I am trying to share my screen on Google Chrome 88 with WebRTC and I run GNOME 3.36 with Wayland with the following packages:

I tried to setup everything from scratch with the following steps:

  1. Build the packages with autotools and install the required dependencies along with their .pc files for pkg-config
  2. Copy the .so shared libraries for pipewire to /usr/local/lib/x86_64-linux-gnu and run ldconfig to refresh the config
  3. Copy the unit files in /usr/local/lib/systemd/user for systemctl and start the services

With everything correctly installed, I enabled chrome://flags/#enable-webrtc-pipewire-capturer and tried this demo and it says "Success!" but I only see a black screen...

EDIT: It looks like the problem has been fixed as of Ubuntu 22.04 LTS. I tried on a Thinkpad X1 laptop, with the default installation and I was able to share my screen on the demo link above.

emandret
  • 553
  • 1
    Solved by enabling first option (WebRTC PipeWire support) at: chrome://flags/#enable-webrtc-pipewire-capturer – Constantin De La Roche Dec 02 '22 at 15:11
  • That works for me in Chromium - once. Then after I close Chromium I am unable to restart it and there are segfaults reported in syslog. I need to then do a full reboot to get stuff working again! – artfulrobot Jan 26 '23 at 14:01

4 Answers4

25

Ubuntu 22.04

Support may be working out of the box, but I did not have all the needed packages on upgrading from 20.04.

I was able to have screen sharing working with the following:

(!) if this breaks your audio, see this bug

sudo apt install xdg-desktop-portal-gnome gnome-remote-desktop

And reboot if necessary (or see Troubleshooting section).

YMMV, but for sure pipewire-media-session (dependency of gnome-remote-desktop) and xdg-desktop-portal-gnome are needed and were not installed by do-release-upgrade from 20.04.

After that I was able to validate screensharing with dpkg/snap/flatpak apps as follows:

Firefox snap

The default Ubuntu 22.04 firefox (snap) uses wayland by default, and supports WebRTC screensharing (test eg with this WebRTC experiment)

portal in firefox

Unfortunately some software (Hello M$ Teams) "blacklists" firefox currently.

Chrome wayland dpkg

Chrome 99 is still X11 by default (despite the support flags being available since April 2021), so start it with

google-chrome-stable --enable-features=UseOzonePlatform --ozone-platform=wayland &

And to make it permanent, copy+edit /usr/share/applications/google-chrome.desktop to ~/.local/share/applications/

You also need to enable the WebRTC PipeWire support flag (chrome://flags/#enable-webrtc-pipewire-capturer).

[portal in chrome]

It still suffers from the "double" portal issue discussed in WebRTC/Chromium Updates In 2020, but it's usable.

Kooha flatpak (screen recorder)

sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install io.github.seadve.Kooha
flatpak run io.github.seadve.Kooha &

[portal in Kooha]

Troubleshooting

Commands that can replace rebooting:

systemctl --user enable pipewire-media-session
systemctl --user start pipewire-media-session
systemctl --user restart xdg-desktop-portal-gnome
  • Relevant Arch wiki
  • wlroots' "It doesn't work" Troubleshooting Checklist
  • background: Flatpak portals - how do they work? by Peter Hutterer.
  • tip: run apps from command-line and check output for error messages like Error creating screencast session: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.ScreenCast” on object at path /org/freedesktop/portal/desktop -- which means that you don't have a portal implementation -- e.g. this is the expected dbus setup as seen with d-feet: d-feet If you see org.freedesktop.impl.portal.desktop.gnome has some interfaces but not the ScreenCast one, it can mean a missing pipewire setup, or that xdg-desktop-portal-gnome was not restarted to pick it up.
eddygeek
  • 1,669
  • 1
  • 15
  • 17
  • 1
    Thanks man you helped: I was stuck since the last 8 hours – karthik nair Apr 11 '22 at 08:01
  • Updated from 21.10 and had the same problems. This description + log out + log in solved it. Thanks! – t2d May 04 '22 at 13:29
  • Just installing xdg-desktop-portal-gnome was enough to fix screen sharing for me on Firefox (snap) and slack on Ubuntu 22.04. Thank you! – LeartS May 10 '22 at 14:47
  • I've been banging my head against the wall because for some reason apt is unable to locate xdg-desktop-portal-gnome... I tried to manually build it but that is also not working for me because it complains that xdg-desktop-portal is missing, though it shows as installed in apt. How can I add the missing repo so that apt can find xdg-desktop-portal-gnome? – rodrigolece Jun 30 '22 at 17:21
  • @rodrigolece you must be using an older ubuntu. Only >= 22.04 has it, no extra repo needed. See https://packages.ubuntu.com/jammy/xdg-desktop-portal-gnome – eddygeek Jul 27 '22 at 13:52
  • Thanks so much, worked also on Manjaro with Gnome & Wayland for me. I already had the packages xdg-desktop-portal xdg-desktop-portal-gnome xdg-desktop-portal-gtk installed, but needed to install the pipewire-media-session (which was not installed) and enable/start it via systemctl --user enable pipewire-media-session && systemctl --user start pipewire-media-session. Having both flags set in Chrome (chrome://flags/#ozone-platform-hint = Auto + chrome://flags/#enable-webrtc-pipewire-capturer = Enabled), MS Teams now does the screenshare of my whole screen like a charme. – jonashackt Nov 15 '23 at 17:00
  • The solution with pipewire-media-session works even when the installer claims, that pipewire-media-session is deprecated and will soon be removed from the repositories. Please use 'wireplumber' instead. Don't get hesitated and just install it, it will work. – jonashackt Nov 15 '23 at 17:01
4

The easy solution is to use ubuntu 21.04 or later which properly integrates pipewire. Ubuntu 21.04 also defaults to wayland (intel and amd only) so pipewire screen sharing should work out of the box.

The reason is this ubuntu bug which seems to have been solved for 21.04. This issue is not caused by firefox or chromium/chrome.

You may also have some success backporting packages from 21.04 into 20.04 LTS. Unfortunately in this case the only easy solution cannot be used in ubuntu LTS until 2022 (when 22.04 LTS gets wayland and pipewire by default).

I got this info from a reddit comment where the same question is asked.

  • FYI, I am the OP of that Reddit post. Thank you anyway, and let's wait for 21.04 and hope for the best. – emandret Mar 08 '21 at 10:40
  • 9
    I installed ubuntu 21.04 few weeks agon and I cannot share the screen by default...it's just black, then I started reading about all this mess. As a simple user this is very frustrating because I have very little knowledge about what's going on. I had to flip some flag in chrome to use some PipeWire who knows what, and now instead of selecting the screen and window the selection popups twice. All I ever needed is just to share the screen on a video call in a web browser :/ – oglop Jun 11 '21 at 10:39
  • @oglop Yes it is unfortunately not yet perfect sometimes, but luckily there is a lot of work to fix these issues. Chromium has that flag because of the dual pop up issue. But in the future that flag will be removed and that dual pop issue will be fixed. See this blog post for more info about the issues in chromium/electron apps http://jgrulich.cz/2020/12/18/webrtc-chromium-updates-in-2020/. I’ll also note that firefox should work out of the box without any configuration, which is again is where chromium should be (but unfortunately isn’t yet). – blamesystemd Jun 11 '21 at 15:35
  • @blamesystemd I'd give firefox a chance if it even loaded the page, first thing after instalation it took more than 20 seconds due to some problem which I narrowed down to be a DNS problem possibly with systemd :( – oglop Jun 13 '21 at 04:54
  • That’s defintely not something that should happen. Can you try the Firefox snap instead? sudo snap install firefox – blamesystemd Jun 14 '21 at 05:22
  • It works -- kind of. It only shares a portion of my screen and there is no way to share the whole screen. Bugged. – Joshua Robison Oct 16 '21 at 03:10
  • Joshua are you using Firefox or Chromium? In 21.04+ Firefox should work out of the box, Chromium requires enabling PipeWire in chrome://flags. – blamesystemd Oct 17 '21 at 04:06
2

Important info for Ubuntu 22.10 users. I also have problems with screen sharing and I was able to solve them in Chrome by setting chrome://flags/#enable-webrtc-pipewire-capturer to Enabled. I also tried to install pipewire-media-session package, and this package is dangerous! After reboot my sound devices were gone. Fortunately removing that packages brought them back. Regarding Firefox in Ubuntu 22.10 ... screen sharing is still not fully working...

2

For me it worked in Ubuntu 22.04:

sudo apt install xdg-desktop-portal-gnome gnome-remote-desktop

Then using MS Teams in Google Chrome, with the chrome://flags/#enable-webrtc-pipewire-capturer to Enabled

  • Unfortunately I am not sure this chrome settings url or an equivalent are still part of current Chrome by now. – matanox Mar 15 '24 at 03:28