140

Ubuntu 22.04 has a bug which is we can't share our screen on any platforms.

Arun Raja
  • 3,185
  • 3
  • 5
  • 11

9 Answers9

166

The issue with Ubuntu 22.04 is that it now uses a display feature called wayland by default, while in versions prior to 21.04 Ubuntu defaulted to using xorg as its display server. Wayland does not support screen sharing by default (until now, at least!).

To check which display system your Ubuntu is using, please enter this command

echo $XDG_SESSION_TYPE

If the above command outputs wayland, your system is using wayland.

In order to use screen sharing, we have to disable wayland and enable xorg (x11). To do this,

Please go to this file

sudo nano /etc/gdm3/custom.conf

Uncomment this line.

WaylandEnable=false

Reboot your system.

Voila! You can share your screen. You can confirm this by re-entering this command.

echo $XDG_SESSION_TYPE

Now it should display x11.

Esther
  • 3,210
  • 11
  • 24
Arun Raja
  • 3,185
  • 3
  • 5
  • 11
  • 8
    Lifesaver, thank you. I've had this issue ever since upgrading to 22.04, I'm still shocked this question barely has any upvotes. – gordon_freeman May 12 '22 at 06:43
  • after I did that, the screen sharing is working but it's super slow – Kyaw Kyaw Soe Jun 02 '22 at 12:11
  • 5
    people using DisplayLink could have problems because of x11 compatibility (using 2 displays through a docking station, for example) – rogelio Jun 09 '22 at 20:45
  • 6
    The minimum qualification for using Ubuntu should be to be a stackexchange user lol. This is really bad practice they break functionality in a stable upgrade. – ahron Aug 16 '22 at 11:32
  • this solution diables all swipe gestures – DBencz Aug 18 '22 at 10:00
  • No it's not. Everything will work just like Ubuntu 20.04 – Arun Raja Aug 18 '22 at 11:57
  • 14
    this gets you working with thirty year old tech, a more modern solution: see [next answer](https://askubuntu.com/a/1421314/139044) (enabling chrome pipewire support) – bernstein Aug 23 '22 at 16:46
  • 3
    I think the author of this answer should **warn** people that other issues can be compromised by downgrading to Xorg, such as [this case](https://askubuntu.com/q/1414283/980324), for example. – Camilo Febres Aug 24 '22 at 05:00
  • 10
    How could Wayland be shipped in a LTS with such a big problem? – nulll Sep 15 '22 at 13:53
  • This also worked for me. On X11 now and everything is working as supposed to. I guess it will take another 15 years for them to sort this Wayland bs out ¯\_(ツ)_/¯ – Jorge Campos Oct 04 '22 at 22:29
  • 1
    So, there is no disadvantage of using X11 instead of Wayland? – Agnishom Chattopadhyay Oct 18 '22 at 22:06
  • 1
    Then my second monitor turn into black screen after reboot... – Nicolas Dec 28 '22 at 14:35
  • 1
    problem with x11 I have: touch screen not working properly, any dialog window has no focus -> which is super anoying. This shouldn't be accepted answer. – Dutch77 Mar 08 '23 at 08:27
  • This should not be the accepted answer. As others have said, while downgrading _might indeed help the problem_, I just don't feel like downgrading is the _right_ solution. – Mike Williamson Mar 08 '23 at 13:04
  • 2
    @gordon_freeman Once you select your user in the login screen, a cog-like button appears in the lower right corner. Clicking on it let's you select "Ubuntu on Xorg" vs "Ubuntu" (which defaults to Wayland). It will remember this preferences for your user. – Tulains Córdova Mar 08 '23 at 15:22
50

Only works for web browser

Go to chrome://flags/#enable-webrtc-pipewire-capturer using the address bar of your browser.

enter image description here

Click the drop down menu, and click Enabled.

enter image description here

Finally Restart the browser

This will enable the browser to prompt screenshare access

9

For Slack in-app screen recording and screen sharing:

  1. Quit the Slack app completely (use Quit from the tray icon).
  2. In the terminal:
slack --enable-features=WebRTCPipeWireCapturer
  1. See if it works.
  2. (Optional) Persist the change across reboots:
gedit admin:///usr/share/applications/slack.desktop

In text editor find a line that says:

Exec=/usr/bin/slack %U

Change the line to say:

Exec=/usr/bin/slack --enable-features=WebRTCPipeWireCapturer %U

That's it. Tested on Ubuntu 22.04LTS and:

$ slack --version
4.27.156

$ echo $XDG_SESSION_TYPE
wayland

$ dpkg -l | grep -i pipewire
ii  libpipewire-0.3-0:amd64                    0.3.48-1ubuntu1                         amd64        libraries for the PipeWire multimedia server
ii  libpipewire-0.3-common                     0.3.48-1ubuntu1                         all          libraries for the PipeWire multimedia server - common files
ii  libpipewire-0.3-modules:amd64              0.3.48-1ubuntu1                         amd64        libraries for the PipeWire multimedia server - modules
ii  libspa-0.2-modules:amd64                   0.3.48-1ubuntu1                         amd64        libraries for the PipeWire multimedia server Simple Plugin API - modules
ii  pipewire:amd64                             0.3.48-1ubuntu1                         amd64        audio and video processing engine multimedia server
ii  pipewire-bin                               0.3.48-1ubuntu1                         amd64        PipeWire multimedia server - programs
ii  pipewire-media-session                     0.4.1-2ubuntu1                          amd64        example session manager for PipeWire

Source: https://github.com/flathub/com.slack.Slack/issues/101#issuecomment-808430530

kubanczyk
  • 542
  • 6
  • 13
5

Since Wayland is not supporting screen share by default, there is already an experimental way with chrome browser.

First you need to export the metadata API from the pipewire media sessions.

sudo mkdir -p /etc/pipewire/media-session.d/
sudo cp /usr/share/pipewire/media-session.d/media-session.conf /etc/pipewire/media-session.d/
sudo sed -i 's/#metadata/metadata/g' /etc/pipewire/media-session.d/media-session.conf

At chrome experimental features enable the WebRTC PipeWire support

chrome://flags/#enable-webrtc-pipewire-capturer

Restart the browser and now you can share your screen.

5

I tried the global.context.unsafe_mode=true solution, but Google Meet was still showing black screens, so didn't test it any further.

What worked for me was switching to X11/Xorg, which I did by

  • logging off
  • clicking gear icon at bottom right
  • selecting "Ubuntu on Xorg"
  • logging back in
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 31 '22 at 19:49
2

As mentioned this is a Security Feature of Wayland. You can either use XOrg or disable the save mode of Wayland by doing:

  1. Press Alt + F2
  2. Type lg and press enter
  3. Disable save mode by typing global.context.unsafe_mode=true and enter

This will work till you reboot/log out. I wrote a small Gnome Extension which does can disable the safe mode on demand. See https://github.com/julianpollmann/zoom-wayland-gnome-extension

polyte
  • 159
  • 3
2

I changed graphic drivers (in additional drivers menu) from xorg-server to Nvidia proprietary. It worked for me.

Vaniog
  • 21
  • 1
1

Now the screen sharing in Wayland is available with the zoom client for Ubuntu.

https://support.zoom.us/hc/en-us/articles/205759689#:~:text=Resolved%20an%20issue%20regarding%20sharing%20content%20on%20Gnome%2041%20with%20Wayland%C2%A0

Check the release notes in 5.11.0 (3540) release.

Vajira Prabuddhaka
  • 791
  • 2
  • 7
  • 15
-1

I was resolved by going to chrome://flags/#enable-webrtc-pipewire-capturer and changing the value from Default to Enabled.

then

Search for the file.conf in /etc/gdm3/ in my case, Ubuntu 20, it's custom.conf

sudo nano /etc/gdm3/custom.conf

uncomment the line

#WaylandEnable=false to be WaylandEnable=false

then reboot

"uncommenting that line will use the Xorg display manager instead of Wayland "

  • Please do not copy and paste identical answers to different questions on AU. The system has detected this *exact* answer given to 3 slightly different questions. – andrew.46 Sep 19 '22 at 23:16
  • Please do not copy and paste identical answers to different questions on AU. The system has detected this *exact* answer given to 3 slightly different questions. – andrew.46 Sep 19 '22 at 23:16
  • This answer mixes two conflicting answers. Do not use it. – Jivan Pal Apr 25 '23 at 17:38