Note: This was originally posted on Reddit. However, I have now decided to move the guide to lemmy and I will most likely delete the one on Reddit soon.

There are multiple options to achieve Wayland screen sharing with discord. I will cover two here.

OPTION 1 (Recommended):

There is a web-based discord client for Linux called “Webcord” that supports Wayland screen sharing. You just have to install it, open it, sign in, and you’re done.

You can install it by downloading your preferred package from here or by using the flatpak version avaliable on flathub.

If you dont have flatpak set up - here is another quick guide.

That’s it! You can now start screen sharing on Wayland!

In case you are interested in streaming your desktop audio as well, there is another Discord client called discord-screenaudio to do just that. It is also available on flathub.

OPTION 2:

What you’ll need:

Step1:

Open WebApps and click on the little + icon in the bottom. Fill in the name (Discord) and the web Address (discord.com/app). The icon should apply automatically. As a browser, choose your Chromium-based browser. Then activate the switch “Isolated Profile” and click Ok.

Step2:

You now should be able to find Discord in your application-launcher of your choice. If you see discord twice, that means that you have now both the “real” Discord app and the new WebApp. Then try to launch the WebApp Discord. You now can sign in and use discord just as normal. However, there is still no Wayland support. We will activate it in step 3.

Step3: (unnecessary if you use Firefox)

While in the WebApp Discord, press Ctrl+T. A new window should appear. Then type chrome://flags in the address bar and press enter. Now search for “WebRTC PipeWire support” and change it from default to true. Now click “Relaunch” in the bottom of the window. If you have done everything right, you should now have Wayland support :)

I hope I could help you in some form, and have a nice day!

Optional: (And for more advanced users) Running the Discord WebApp without the use of Xwayland

Since Chrome version 97:

While in the Discord WebApp, press Ctrl+T. Type chrome://flags in the address bar and hit enter. Search for "Preferred Ozone platform". Change it from “Default” to “Auto”. Then relaunch Discord. That’s it.

Chrome Versions below 97:

Note: This is ONLY tested with arch/Manjaro and Brave. It could work on other systems and browsers too, but this is not guaranteed. So you basically just have to enable chromium Wayland flag. You can do this by creating a config file at $HOME/.config/brave-flags.conf. Do that by running nano $HOME/.config/brave-flags.conf (If you are running another browser than Brave, I guess you could replace brave with the name of the other browser, but I didn’t test this). Now insert the flag --enable-features=UseOzonePlatform --ozone-platform=wayland save it by pressing Ctrl+O and exit with Ctrl+X. Now launch Discord again and see if it runs natively on Wayland. You can do this by installing and running xeyes (when installed, simply run xeyes in your terminal). When you move the mouse over a window and the eyes are moving, it uses Xwayland or X11. If not, you successfully activated Wayland.

    • TheCreativeNameOP
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      You are right; it does not. At least not yet. But I did mention in the post that if you want audio, you can use discord-screenaudio, just as you suggested.

    • ffhein@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      IIRC it’s a webapp thing, and supposedly it shouldn’t be able to grab desktop audio on any platform, but Discord developers made a workaround for the Windows clicent.

      In the past I used a tampermonkey script which caused the Discord web client to create 2 different sinks (i.e. one for voice and another for the stream) so I could route the sound manually using qpwgraph.

      I’m guessing discord-screenaudio does something similar, because it was possible to do the same script injection with the official discord client.

  • simple@lemm.ee
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    It’s worth noting you don’t have to install the web app to screen share, you can just open Discord in Firefox and it’ll ask for your permission to share your screen, which works totally fine. I use the normal discord app all the time and switch to the browser version when I need to share something, it’s less of a hassle than the other options.

    • TheCreativeNameOP
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Funny, I remember getting the exact same comment on Reddit when it was still there. While this is obviously correct, to me, it just feels wrong to use Discord in a browser. Also, other clients offer functionality that not even Discord in a browser supports. But for those who don’t mind or don’t need those extra features, it’s a great solution, no doubt.

  • Sh1nyM3t4l4ss@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    You can also just use the official client in combination with KDE’s XWayland video bridge (works outside of KDE too)

  • Tschuuuls@feddit.de
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    If there is a fix for steamdeck discord screen sharing in game mode, preferably with audio, let me know lol.

    • TheCreativeNameOP
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Yeah, I’ve actually been looking for such a thing too. I don’t think there is anything yet, but I’ll let you know once I find something.

    • Eeyore_Syndrome@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      What would make me happy is if Valve made broadcasting gameplay sharing work on Linux through steam itself.

      Tho I think maybe it’s also broken on Linux as well. 🤯

      When I really wanna share gameplay with my friends I just use my YouTube stream.

      Supports AV1 on OBS at 1440p60fps Livestream. Even twitch won’t let me go past 1080 and doesn’t support AV1.

      I’m not paying discord a ¢ to do the same. Especially when they won’t support Linux themselves at all.