Files
gists/sysadmin/troubleshooting-screen-sharing.md

1.6 KiB

Screen sharing

"We use xdg-desktop-portal (+ backend implementation) for communication between the app requesting to share a screen and between desktop (Plasma or Gnome)." [1] (or in this case, sway). See also [2].

System info

=== Kernel ===
6.18.18-1-lts
=== Sway ===
sway version 1.9
=== xdg-desktop-portal (installed packages) ===
xdg-desktop-portal 1.20.3-2
xdg-desktop-portal-wlr 0.8.1-1
xdg-desktop-portal-gtk 1.15.3-1

Logs

Mar 15 09:22:00 andreas-laptop systemd[1178]: xdg-desktop-portal-gtk.service: Start request repeated too quickly.
Mar 15 09:22:00 andreas-laptop systemd[1178]: xdg-desktop-portal-gtk.service: Failed with result 'exit-code'.
Mar 15 09:22:00 andreas-laptop systemd[1178]: Failed to start Portal service (GTK/GNOME implementation).
Mar 15 09:22:00 andreas-laptop /usr/lib/xdg-desktop-portal[1347]: Failed to ReadAll() from Settings implementation: GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: Could not activ>

Solution

We first have to tell xdg-desktop-portal that it should use the wlr backend to route screen capture requests. In ~/.config/environment.d/sway.conf add

XDG_CURRENT_DESKTOP=sway

We also have to set up the link between the wayland compositor and xdg-desktop-portal. In ~/.config/sway/config, add

exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP

References

  1. https://jgrulich.cz/2018/07/04/how-to-enable-and-use-screen-sharing-on-wayland/
  2. https://wiki.archlinux.org/title/XDG_Desktop_Portal