Permanent fix for screen sharing not working in KDE (Firefox, Brave, Chrome)

Ubuntu Support Template

Ubuntu Version:
Example: 26.04

Desktop Environment (if applicable):
Example: KDE Plasma (6.6.6)

Problem Description:
When trying to screen share on Google Chrome, Firefox or Brave, maybe the first time it works, but if you try to stop and share X amount of times, typically around 4 to 8, it will stop working and the box that shows in the screen sharing popup inside the browser will show empty. In KDE, the red recording round icon that shows in the system tray will stay on and will fail to screen share properly after that, requiring a reboot.

Relevant System Information:
Using Nvidia 5090, Intel 14900K

SOLUTION:
After testing out for 2 to 3 days already several solutions, from editing the kde-portals.conf file, to editing the systemd file for it, to even editing the launch options for all browsers (eg: jumping from Wayland to X11 and back, disabling opengl, disabling vulkan, enabling webrtc flag options, etc..), the one that worked was going to this link and downloading the (currently) 1.20.3 version of xdg-desktop-portal

https://packages.ubuntu.com/questing/amd64/xdg-desktop-portal/download

Then installing it via dpkg

and then marking it as a HOLD package so any updates do NOT update the package too.

After rebooting I was able to test 30 times on Brave (Continuously to try to break the xdg-desktop-portal), then tested 30 on Chrome and 30 on Firefox. In all cases, just the fact that they passed 10 consecutive tests means that the issue is the 1.21 version of the package. you can see the changelog of it here:

This solves the main issue I was having with my clients and teammates.

In order to test it on your end, simply open google meet, zoom, whereby, discord or whatever you are using to screen share and start sharing something and stop it. Then share again. Then stop. Keep on doing this as many times as you want. With version 1.21 it will fail around attempt number 4 to 8 for me. With version 1.20 it did not fail and I was already passing 30 with Brave.

I tested chrome and firefox too just to be 100% sure this was the solution.

I will post any updates here because this was critical for me.

The browser launcher does not have any parameters on it. Before it had: --ozone-platform=x11 %U
The systemctl --user edit xdg-desktop-portal is as it comes by default with Kubuntu 26.04

The kde-portals.conf file is empty, before I had put things like this which did not work:

[preferred]
default=kde
org.freedesktop.impl.portal.ScreenCast=kde
org.freedesktop.impl.portal.Screenshot=kde

[screencast]
restore_token=false

So currently everything is default EXCEPT for the xdk-desktop-portal package rolling back from the default 1.21.1 to the 1.20.3 and then marking it as hold to avoid upgrades applying to it.

2 Likes

This is rather weird looking at the diff, it is essentially just a one line change to the web extensions portal (which I wouldn’t actually expect to be involved with screen sharing at all)… you should file a bug, I’m sure @nteodosio wants to know about it…

2 Likes

OKay I tried submitting it with ubuntu-bug but it crashes just before it submits. Apart from this what other options do you know I have using kubuntu 26.04:

sudo ubuntu-bug xdg-desktop-portal

I would try it without sudo first…

3 Likes

This was it. Thank you so much. Ended up here: https://bugs.launchpad.net/ubuntu/+source/xdg-desktop-portal/+bug/2163211

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.