Screensharing is broken on Wayland (Linux)
Wayland is the new display server protocol for Linux, replacing X11.
In order to increase security, it won't let apps capture the screen without receiving permission to do so from the user. Apps should now capture the the screen using PipeWire that's in turn going to request permission on the desktop side using xdg-desktop-portal.
Chromium, and by extension, Electron has already supported this for a while and Discord is fully capable of screen capturing while running as a webapp inside a browser (Firefox, Chromium etc).
The problem is that despite having migrated to a recent version of Electron, the native linux app refuses to use Electron's internal screensharing mechanism and instead insists on trying to implement its own without making use of PipeWire.
As a result, screensharing is entirely broken on every single major distro that already defaults to Wayland.
In order to reproduce this, launch DiscordCanary natively on Wayland with --enable-features=UseOzonePlatform --ozone-platform=wayland (using Chromium/Electron's native Wayland support).
You may now confirm this is a native Wayland window using xprop and hovering over it, the cursor won't change to a crosshair as it only works on X11 windows (xkill won't work either etc).
There's obviously no way to screenshare without PipeWire on Wayland (and no, you can't screenshare using XWayland compatibility either), so let's relaunch Discord enabling that too:
discord --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer
Instead of enabling support for WebRTCPipeWireCapturer Discord somehow launches in X11 mode and runs through the compatibility layer while also not enabling PipeWire capturing either. This should work ootb on any recent version of Electron unless built with that feature explicitly disabled, yet it won't for Discord/DiscordCanary cause it explicitly tries to do its own thing.
What should happen is Electron should start with PipeWire capturing enabled, effectively enabling Wayland screensharing. If the first two flags are provided, adding --enable-features=WebRTCPipeWireCapturer shouldn't somehow break these and revert to the X11 backend.
In contrast to this, using Discord inside any major Firefox or Chromium based browser works as expected as uses the browser's own WebRTC screen capturing mechanism.
As far as I can tell, Discord tries to be smart and screencapture in its own way as unofficial community builds are also affected despite them building Electron with PipeWire screencapturing.
So please disable whatever you're trying to do upon detecting you're running inside Electron and let Electron take care of this for Linux users in general, or at least for the ones using Electron's native Wayland backend.
The support is there and should work as expected, just as it does for most screensharing electron apps.
33
-
I guess this isn't getting fixed anytime soon. I might see about pushing XWayland screensharing. Of course it would fly in the face of Wayland security on screensharing, but at least basic functionality would be restored.
0 -
With the canary update to electron 28 maybe were closer to this being fixed, the screenshare previews do appear. And you are able to select your screen and click to share but then it loads infinitely.
0
Iniciar sesión para dejar un comentario.
Comentarios
2 comentarios