electron: [Bug]: Redundant app-created screen share dialog on Linux Wayland

Preflight Checklist

Electron Version

Any version supporting PipeWire (Electron 13 works, used in Element, Jitsi Meet Electron, and Slack).

What operating system are you using?

Any Linux on Wayland

Expected Behavior

On Linux Wayland clicking a screen share button should immediately lead the user to the PipeWire/XDG Desktop Portal dialog (provided by operating system). This is the ideal way for apps to request to view the screen in a sandboxed Linux environment.

Actual Behavior

On Linux Wayland sessions Electron apps show an uncessary dialog when screen sharing, that causes extra clicks and confusion.

See what Element and Jitsi Meet Electron look like currently on Wayland:

!(Element Wayland PipeWire Screen Sharing)

!(Jitsi Wayland PipeWire Screen Sharing)

When on Wayland sessions, Electron apps should skip showing the app-created dialog, and simply immediately call the PipeWire/portal prompt.

To recap for Element:

Current steps (shown in first video):

  1. Click circular share button in video meeting box.
  2. Click image box with missing preview.
  3. Click rectangular share button.
  4. Select display or window in operating system provided dialog.

Proposed steps for Linux Wayland users:

  1. Click circular share button in video meeting box.
  2. Select display or window in operating system provided dialog.

Additional Information

The Wayland security model means apps cannot assume they can view any displays or windows. That is why the dialog is not able to show a picture preview properly. Even if the picture could be fixed, the dialog is still not particularly beneficial to Wayland users and should not be shown.

This likely is best fixed in Electron and not elsewhere. Three Electron apps, Element, Jitsi Meet Electron, and Slack are known to have this redundant dialog issue. However, in Chromium the issue is different as Chromium itself manages the dialog–the app is not able to choose how it looks unlike in Electron (see above, Jitsi and Element’s dialog looked different). Also, unlike Electron Chromium needs tab sharing as well, where in Electron tab sharing doesn’t exist. So Electron can provide easier screen sharing functionality without losing anything, simply by avoiding letting apps create a redundant dialog when on Wayland.

There are some issue with apps like Teams, Discord, Skype, Signal and potentially other Electron apps with using PipeWire to screen share on Wayland. Their issues are out of scope for this issue–removing the unecessary dialog is a valid improvement that will help Electron apps that can already mostly screen share on Wayland properly. Fixing the broken apps is a seperate problem (and is most likely due to using unsupported Electron versions or non-standard WebRTC implementations).

To enable PipeWire screen sharing on Wayland in Electron or Chromium you might need to pass --enable-features=WebRTCPipeWireCapturer at runtime. Both Element and Jitsi (in videos above) enable this flag at build-time. This was done primarily as the experience with the flag (even with this dialog issue) is far better than without it. Without the flag Electron or Chromium will have mostly broken and unusable screen sharing functionality on Wayland.

Note this issue is not related to Wayland support in Electron in general, this is just about fixing the screen sharing dialog. Electron can be running in xwayland or Wayland and the issue will be the same.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 15
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Still relevant

Any updates here?

It doesn’t seem like this bug got fixed automatically.