jitsi / jitsi-meet-electron

Jitsi Meet desktop application powered by :electron:
Apache License 2.0
1.5k stars 462 forks source link

Screen sharing on Linux with Wayland pops up a select application/screen window twice #963

Open cedricroijakkers opened 4 months ago

cedricroijakkers commented 4 months ago

Description

Most Linux distributions are now switching to Wayland from X11, which has a completely different way of handling window security. While in X11, it was perfectly possible for one application to use a part of the display which was being used by another application, in Wayland this now requires user input to approve it first. In Jitsi Meet Electron, this now causes the behaviour that you have to select the application/window twice before the actual screen sharing starts. You first select (and implicitly approve) the screen that you wish to share in Wayland, but then have to select it again in Jisti. By the time you reach the Jitsi selection, there is only one option left to select, so this is useless. As an extra bonus, you only have a few seconds to select the one screen in Jitsi that you want to share, if you are too slow, the Wayland screen selection window pops up again because you did not finish the sharing action. This is not only useless, but also confusing and will cause problems for people with reduced mouse mobility.

Current behavior

The following screenshots are from GNOME 46 running under Wayland, but they are fairly identical under other desktop environments.

When you click the share button in Jitsi, the following window pops up. This is from xdg-desktop-portal-gnome which is the GNOME Wayland integration that implements this functionality, but different desktop environments have a similar implementation:

image

You already see the underlying "Share your screen" window coming from Jitsi, but so far this is normal. As you can see I have two screen, so if I select the AOC screen, the popup dissapears and I get dropped into the Jitsi share screen selection:

image

Now I have about 5 seconds to click on the "Application window" tab (fun fact: not the "Your entire screen" tab, even though I selected an entire screen!) and select the one and only application listed in there, and then the screen sharing will start. If I am not quick enough, the desktop portal selection screen pops up again, and I have to repeat everything.

Eventually, if I'm fast enough, it works, but this is not very practical.

Expected Behavior

Jitsi should detect the usage of Wayland, and should not present the second screen sharing window. Only the desktop portal should be presented, where the user can select a window or a screen. After selecting, the screen share should start immediately in Jitsi.

Possible Solution

André Oliveira from the Ferdium development team recently fixed this issue in Ferdium. If I use the exact same Jitsi server in Ferdium instead of Jitsi Meet Desktop, it works flawlessly. I have also tested Ferdium on X11 and that still works too. Other OSes also work, because Ferdium has built-in detection for Linux and Wayland. Maybe the pull request where he fixed it can be used as an inspiration to fix the issue (since Ferdium is also an Electron 30 application).

Steps to reproduce

See current behaviour.

Environment details

Any Linux distro with the Wayland window manager.

csett86 commented 4 months ago

Yes, the screensharing with wayland is suboptimal at the moment. Fullscreen sharing does not work, and the double dialogs exist... see #829 for all the details and history

csett86 commented 4 months ago

Thanks for the hint on how it was improved in ferdium!

cedricroijakkers commented 4 months ago

I recently saw the upgrade to Electron 30 in Jitsi too, so I thought the hint from Ferdium might be a good idea. André absolutely hit it out of the park in the Ferdium implementation, all kudos to him :smile:

saghul commented 4 months ago

I think the trick there is good. If Wayland is used just assume the one and only selected source is the one and don't show the dialog.

SpecialAro commented 4 months ago

@csett86, André Oliveira here 😄

Let me know if you need any help in "fixing" (though it is more of an hack than a fix) this!