193

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

Arun Raja
  • 4,431

13 Answers13

236

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.

If x11 is not shown yet, run the command below:

sudo systemctl restart gdm
sotirov
  • 4,379
Arun Raja
  • 4,431
64

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

14

For Slack in-app screen recording and screen sharing before version 4.33.90 (the entire video capture got broken in or around 4.33.90, so I'm unable to test screen recording):

  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
  • 605
9

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.

6

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
5

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
  • 189
5

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

Vaniog
  • 89
5

I have a computer with a Nvidia EVGA Geforce GTX - 1660 Super graphic card with a Ubuntu 22.04.3 LTS OS and none of the above answers worked for my case. Neither the chrome flag, neither dismissing the safe mode of wayland and neither changing to use xorg on logon screen.

What did the job was going into Additional Drivers then select the option Using NVIDIA driver metapackage from nvidia-driver-535 (proprietary, tested) amongst many others (this one did the job at first so I didn't change anymore). Previously the selected one was the Using X.Org X server -- Nouveau display driver from xserver-xorg-video-nouveau (open source)

Hope it helps someone.

vr4u
  • 51
3

(On Ubuntu 22.04.3 LTS)

Deactivating wayland as the first answer suggests worked the best but you have to give up the much better touchpad uses.

Alternatively I found a solution here that works on the browser version, at least for Zoom and Google Meet. It requires installing the packages xdg-desktop-portal-gnome and gnome-remote-desktop and then rebooting:

sudo apt install xdg-desktop-portal-gnome gnome-remote-desktop
2

While reverting back to x11 did work for me, I wanted to find an alternative that allowed me to continue using Wayland. What ended up working was uninstalling the snap version of zoom and installing the .deb downloaded from Zoom's website

brad
  • 121
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.

1

After struggling for days I found the solution from this thread only

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

But there are many! So the following one worked for me (just so you guys save time and know this actually works).

And doing the wayland method used to break my display and turn it into -ve colours.

Using NVIDIA Server Driver metapackage from nvidia-driver-535-server (proprietary)

bfontaine
  • 197
-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 "