element-desktop
element-desktop copied to clipboard
Screen sharing fails on Wayland
Steps to reproduce
When I am in a video conference and I want to share my screen this does not work, the dialog box which allows you to choose between the whole screen and a window appears but it is empty and the share button at the bottom right is grayed out when I use Wayland on the other hand it works correctly with x11 the dialog box shows my screen correctly and I can share it.
Outcome
What did you expect?
I wish to have a fix or solution to make it work natively with the default ubuntu configuration (wayland)
What happened instead?
The share button is grayed out and it is impossible to select the screen or application to share because it does not appear.
Operating system
Ubuntu 22.04 LTS
Application version
Version de Element : 1.11.69, Version crypto : Rust SDK 0.7.0, Vodozemac 0.6.0
How did you install the app?
https://element.io/download
Homeserver
non-public server, synapse server on matrix i think
Will you send logs?
No
just to make sure... do you have an XDG Desktop Portal installed for your desktop env? They are needed for securely accessing resources from outside an application sandbox.
just to make sure... do you have an XDG Desktop Portal installed for your desktop env? They are needed for securely accessing resources from outside an application sandbox.
just to make sure... Where can i see it's needed on the download page ? https://element.io/download#linux
and yes i have: XDG Desktop Portal v1.14.4-1ubuntu2~22.04.1
Hi @GalouFR it is not a requirement of the chat client... It is more of a requirement imposed by Wayland and pipewire.
In https://github.com/element-hq/element-desktop/issues/2058, @Destinyg133 is saying that
I managed to fix it by adding these for electron config "--enable-features=WebRTCPipeWireCapturer"
"--ozone-platform-hint=auto"
You can set these flags more permanently by means of [modifying the .desktop file]of an application and adding the flags to the end of the Exec= line, or more cleanly by using the configuration files.
It didn't work for me though.
There are a bunch of people with this problem. please see above issues marked as dupes
I know, I mention these other issues being duplicate of this oldest one. And all these duplicate issues tends to prove that it's an important one that impact a lot of users. It has something to do with electron as there isn't any issue on element-web, maybe related to https://github.com/electron/electron/issues/41551. I wonder if it would be hard to make an element-desktop based on element-web thanks to https://tauri.app/ instead of electron and would that solve this issue? As I ask the question, I see that an issue is open about this idea : https://github.com/element-hq/element-desktop/issues/771
Screen sharing works in a way for me but is not properly implemented. Selecting a window or entire screen in the pipewore prompt does add an option to application windows in Element. It will re spawn until you close Elemnt but screen sharing should work. If you close the pipewire promt element instantly crashes.
I always thought this as an electron bug, because some other electron apps like discord present the exact same error. I even found https://github.com/electron/electron/issues/45198 which is recent. However, in my system, Manjaro testing / Plasma 6.3, I've downloaded the code to reproduce which attached to the issue and it works in my local system. As it is attached as a way to reproduce the issue in electron, it got me wondering: is this an underlying Electron bug or something in Element itself?
Can someone in their system test it by downloading the files, running electron . in the app directory (or in case of Arch, electron34 .) to check if screen share works? If so, this is not a problem in Electron, but in Element...
It is also possible to run npm i then npm start to use a local electron version.
Can confirm that this issue still happens, reproduced the issue running from source with electron36 and KDE Plasma 6.3.5
One notable difference between some of the issues closed as duplicate and the op of this ticket is that the op couldn't press the screenshare button, while in mine and some others the picker shows up, but selections aren't recognized and used, ending in a selection loop. But since the response seems to track both, I'll add it here.
https://github.com/user-attachments/assets/d7268086-aee5-42f5-ace4-7dda383f6e0b
Attaching video (where I list electron version, what commit I'm on and leaving the terminal output in the background)
One thing I can add is that when accessing my self-hosted element call instance with my browser, I can screenshare fine, it is only an issue inside of element-desktop
This is just a lack of Wayland support in element
Well, this is just a lack of Wayland support in electron.
Well, indeed, this is just a lack of Wayland support in Chromium
It does indeed seem like a mess. One thing to note is that Discord - another electron app -, used to have this problem and it has since been solved and screenshare works fine on the same computer, so I think it should be possible to solve. Shame they are closed source so we can't as easily figure out what they did to get it working.
Well, this is just a lack of Wayland support in electron.
Well, indeed, this is just a lack of Wayland support in Chromium
Electron does support this. See my comment above.
When running in element web in Chrome, screen share works too.
So, it seems something's wrong in element itself...
Discord and Chrome are prorpietary, they then might have added code to Chromium/Electron that we can't be aware of, so your comment doesn't really help, pure Chromium and pure Electron app (such as Jitsi or Element) have this issue. And we can't hope for Google to help Chromium/Electron as they would say that it does work with Chrome.
A move that would solve this issue and others might be to move from Electron to Tauri : https://github.com/element-hq/element-desktop/issues/771
Discord and Chrome are prorpietary, they then might have added code to Chromium/Electron that we can't be aware of, so your comment doesn't really help, pure Chromium and pure Electron app (such as Jitsi or Element) have this issue. And we can't hope for Google to help Chromium/Electron as they would say that it does work with Chrome.
A move that would solve this issue and others might be to move from Electron to Tauri : #771
I tried screensharing under Chromium Version 136.0.7103.113 with the command chromium --enable-features=UseOzonePlatform --ozone-platform=wayland and it did work. Or am I misunderstanding something?
Discord and Chrome are prorpietary, they then might have added code to Chromium/Electron that we can't be aware of, so your comment doesn't really help, pure Chromium and pure Electron app (such as Jitsi or Element) have this issue. And we can't hope for Google to help Chromium/Electron as they would say that it does work with Chrome.
A move that would solve this issue and others might be to move from Electron to Tauri : #771
I don't understand why you say Chromium doesn't support screen share under Wayland. It does. @Obamium69 has already tested it. I also tested with no extra flags, and it works:
Also, here's a screenshot of a simple electron app (the same I mentioned in my first comment) which shows a simple Electron app sharing screen under the same system:
So, I still think this is an issue with element-desktop. Perhaps there's a combination of factors triggering the issue...
PS: I'm running Manjaro Linux with Plasma under Wayland.
I'm not saying there is issue with screen sharing under wayland with electron app and Chromium. We are saying it, juste check how many people are complaining about it, please don't focus on me, I just report upstream issues : https://github.com/electron/electron/pull/35630#issuecomment-1254037947. https://issues.chromium.org/issues/40083534
One easy way to compare different apps is via ferdium which is "electron with special tabs" https://github.com/ferdium/ferdium-app
You can try discord, teams, element, jitsi and what not in the same instance.
You will notice some will be able to share the screen while others won't. I have successfully used it for teams, jitsi and discord at least on wayland.
As a workaround for those (like me) which need screen share in Element and have already switched to Wayland: The main advantage of Element desktop over the web version is the system tray icon, which presents a badge indicating you have unread messages.
To bridge this, I've created a small project: https://github.com/luisfpg/element-tray. It shows a simple icon in the system tray, which gets updated (with a red badge) when the Element tab in the Chrome browser gets a new message (badge added), or when all messages are read (badge removed).
I don't plan to evolve the project much more than it currently is, but it might be useful for others. Once the screen sharing is properly supported in Element desktop under Wayland, this new project will be obsolete.