Unable to share screen with Sway WM

Hi folks!

I am using the EndeavourOS Sway community edition as my daily driver. Everything was working fine, including screen sharing. One fine day I decided to experiment with a different WM and installed SwayFx (it’s like sway, but has more eye-candy). Ever since that my desktop screen sharing is broken.

I have since reverted back to Sway as the window manager, but the screen sharing still doesn’t work.

I went through online forums and found out that xdg-desktop-portal and xdg-desktop-portal-wlr are responsible for enabling screen sharing. I have checked and these dependencies are present in my machine & they are at their latest versions.

What can I do to get back the screen sharing functionality?


What program are you using for screen sharing?

Browsers mostly. Firefox and Chrome.
Funnily enough on Chrome I can share other tabs, but on Firefox I can’t share anything.

I have the exact same issue; qutebrowser and firefox do not work at all. I need to give premission for the webpage to record my screen but nothing happens after this.

Nothing happens in MS teams, discord allows me to share individual windows, but sharing a full screen just outputs a black screen without anything on it.

I do not know how to debug this and would love to have some tips on how to approach this.

I first noticed the issues about a week ago and I had been using this exact setup of applications with EOS SwayWM for over a year.

Since this problem got a little too annoying (I was hoping it would fix itself with one of the next updates) I did a bit of digging and found a solution that worked (at least for me, using Firefox)

  1. Make sure you have xdg-desktop-portal-wlr and xdg-desktop-portal installed
  2. In $HOME/.config/sway/config, add the line include /etc/sway/config.d/*
  3. Your drop-in file /etc/sway/config.d/50-systemd-user.conf you should somewhere have the lines
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec hash dbus-update-activation-environment 2>/dev/null && \
     dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_CURRENT_DESKTOP=sway
  1. Restart your computer
  2. systemctl --user show-environment should have XDG_CURRENT_DESKTOP=sway and systemctl --user status xdg-desktop-portal-wlr.service should be running.
  3. Screen sharing with Firefox (and probably most other browsers) should work now. On Firefox you can test this under https://mozilla.github.io/webrtc-landing/gum_test.html

(@joekamprad since the community editions will be deprecated, is this still worth opening a PR, adding the line from 2. to the default config?)

Relevant links:


Yep! I can confirm this solves the issue.
Thanks a bunch!

On another note, it is recommended to also install xdg-desktop-portal-gtk for such things as file choosers (if you need that). WLR doesn’t support that.

With a current sway update, the official package supports this via the file /usr/share/xdg-desktop-portal/sway-portals.conf.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.