-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Linux Wayland screen share dialog #853
Comments
So I don't how would we determine whether we're running Wayland... Do you perhaps know of an Electron app that already does this? |
Well the output of But no I don't know of any Electron apps that change behaviour to remove the redundant dialog if on Wayland. For further context, Jitsi Meet electron and Slack's electron app are 2 other Electron apps that can functionally use PipeWire (that I know of). I recall Slack having this same issue as here when I was able to try it (requires paid plan or trial). Discord, Skype, Teams and Signal are all broken for various reasons (usually very outdated Electron version or non-standard WebRTC implementation from my experience). I feel like Electron itself could be smarter here, so maybe that should investigated. An Electron fix might be a better solution so it can be solved for Jitsi and Slack (and others) in one go. I'll see if I can find more info, but if not I might ping some experts, notably Jan Grulich who AFAIK wrote a lot or most of the PipeWire WebRTC implementation. There's an annoying issue in Chromium with dual PipeWire pop-ups, but that doesn't really seem to exist for Electron. |
I poked around in the WebRTC repo a bit, maybe this is useful? It seems they're using I'm not exactly sure how this could be done in Electron itself though without modifying each app. Neither am I sure what changes Electron makes to the WebRTC capturer code (if any). Maybe we need an Electron patch for 2 "backends" for when screen sharing is called: one for the "standard" use case (i.e. what most Electron apps assume they should do with X11), and another for the "wayland" use case where any custom app dialog should be skipped. I am really not familar enough with any of the relevant codebases to help much more than giving random conceptual ideas though... |
The current way Electron apps do screen-sharing is that they ask for a list of available sources and create their own dialog to choose one. This is completely different from how Wayland does this (AFAIK) which makes me quite unsure as to how this would be fixed in Electron itself. What I would hope for is at least a helper function to tell you whether we're on Wayland but I guess we can do that ourselves somehow |
Chromium doesn't let you use your own dialog, so things are quite straightforward there I assume |
Yeah, I think this is correct, under Wayland the app indeed won't have a list of available sources. I think that needs confirmation though. |
@grulja sorry for the direct ping, but what do you know about app-created dialogs with PipeWire in Electron? There is a seemingly universal issue for Electron sharing with PipeWire, where Electron apps continue trying to use the "X11 way" of screen sharing, meaning they're under the assumption they should be able to see open windows and displays. The user is faced with a now redundant app-created dialog that adds confusion and extra clicks. See the screenshot above and here: jitsi/jitsi-meet-electron#608. In my mind, when a user clicks the share button in an app like Element, they should be taken right to the PipeWire/XDG Desktop Portal dialog. Would it make sense for Electron itself to be patched so apps are prevented from creating their own dialog when under a Wayland session? |
As far as I can tell there isn't much Electron can do besides the helper function because the way things work at the moment is that there is a method to get the sources and a method to request a media stream from one of them. I can't really see what Electron could do differently here 🤷♂️ |
This is basically same problem we have with Chromium. Everytime a user wants to share a screen he has to go through the dialog presented by Chromium and there is no way to skip it even though it is redundant as they want to keep same UI/UX experience across all platforms. With Chromium you even get the portal dialog twice as one is used for preview in the Chromium dialog and the second one is for the actual content on the web page itself.
Yes, that would be the best solution, however, I have no idea how this all is implemented in Electron and if it's something easy to do and if it's something upstream would agree with. I tried to propose same change for Chromium and that change was rejected. |
I have reported this to Electron: electron/electron#30652 I really hope they accept skipping the app-created dialog at an Electron-level, that is the best solution and maybe it could even help convince Chromium to do the same for their dialog. We'll see I guess. For Element issue triagers: this is considered an Electron issue unless the Electron maintainers think otherwise. But until a fix is done this issue will affect Element so I think this bug should be left open. |
So... how about patching Electron's get sources method itself? So if an app calls get sources, but a Wayland session is detected, to just immediately request a media stream on behalf of the app? From what I can tell the method is It feels hacky but surely there's a sane way that idea could be implemented... as otherwise the solution is to get every app to change their implementation themselves, and that will take a long time if Wayland support in Electron is any precedent. |
I am not sure how would that look/solve the problem.. |
Hm.. could you point me to where in Element it tries to share and create the dialog? All I could find in the desktop and web repos was this. If we know what Element tries to call when screen sharing, it might become clearer on how Electron could "trick" Element to not show the Element-created dialog. |
@vchernin, may I suggest we move to a DM ( |
Related: #728 |
Whereas sharing screen works perfectly well with element-web on Wayland, it doesn't work at all on element-desktop on Wayland. |
I've recently uninstalled element desktop and installed elements web as a pwa. It works much better. |
Steps to reproduce
--enable-features=WebRTCPipeWireCapturer
at runtime (this is fixed in develop).What happened?
The dialog is confusing and hard to understand.The dialog attempts to show a preview of your window(s) but there isn't any.
To actually screen share you need to click the "Entire Screen" picture placeholder, and then click share. Both these steps add nothing useful to the experience when on Linux Wayland. The same is true if you try to share the "Application window" instead.
This issue is mainly because Wayland's method for screen sharing is very different from how X11 does it. Applications cannot assume they have access to view the screen, they must specifically request it from the host system. Element needs to be aware of that difference and not show a redundant dialog.
This issue similarly affects another Electron app, Jitsi Meet.
What did you expect?
So the whole dialog "Share Content" is probably best skipped for Wayland, there's no need to have 2 share buttons. When users click share they should be sent right to the PipeWire/Portal dialog.
So to recap:
Current steps:
Proposed steps for Linux Wayland users:
Operating system
Linux
Application version
Element version: 1.8.1 Olm version: 3.2.3
How did you install the app?
Flatpak, identically affects DEB
Have you submitted a rageshake?
No
The text was updated successfully, but these errors were encountered: