A Letter to D1sc0rd for Not Supporting the Linux Desktop by ddtaylor
- Introduction
- Determining the Electron Version in Use
- PipeWire Screen and Audio Sharing
- XDG Portals
- Blocker: Downstream Patches
- Potential Security Risk
- Why It Actually Matters
- The Request to Discord
Disclaimer: This post is not meant to attack the Discord developers, rather to write in hope that Discord will listen to the Linux community about practical issues with the Discord client on the Linux desktop. I also haven’t contacted the Discord developers, so information may be wrong.
TL;DR: Outdated Electron.
Introduction
Discord is popular among the Linux desktop community. Thanks to Electron, the framework that Discord uses, it was possible for Discord to port the client over to Linux very easily. Electron facilitates deploying the same application in different desktop platforms.
However, Electron has one major drawback: it is up to the application developer to update (rebase) to a newer version of Electron to fix security bugs, improve stability and improve compatibility with newer technologies. The Discord client uses an Electron version that is questionably low.
In this article, we’re going to look at PipeWire and Wayland compatibility, specifically the lack thereof; and the potential security risk with their practices.
Determining the Electron Version in Use
Let’s first look at what Electron version Discord is based on, because it’s going to come in handy for the rest of the article.
We’ll need to access the DevTools. The stable client blocks us from accessing the DevTools. In that case, we can use Discord Canary to have more granular control over the client. In this example, I’m using Discord Canary from flathub-beta (com.discordapp.DiscordCanary
).
We can look at the current version from the DevTools by pressing Ctrl
+Shift
+I
, then going to the “Console” tab, and finally typing navigator.userAgent
in the console. At the time of writing this article, the following is the output:
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.17 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36"
The most important bit is at the end: Chrome/91.0.4472.164 Electron/13.6.6
, where the Discord client uses Electron 13.6.6, which is based on Chromium 91.0.4472.164.
Now that we determined the Electron version, let’s look at the problems that happen when using an outdated version of Electron.
PipeWire Screen and Audio Sharing
X11 is slowly being replaced with Wayland in the hopes of improving stability, performance, better compatibility with hardware (touchscreen displays, trackpads, etc.). Since Wayland is architecturally different from X11, there are several implementation differences.
Since 2016, Fedora Linux switched to Wayland on GNOME, later on Plasma and NVIDIA as well. Many toolkits, frameworks and browsers have slowly started supporting Wayland, including Electron.
For the longest time, the community has asked Discord to support PipeWire screen sharing for Wayland and sharing audio in calls.[1] [2] [3] Even the topmost thread on the “Voice and Video” category is about audio on Linux. While the Linux community is a minority, Linux specific requests are common and highly voted in the forums, but are unfortunately left ignored for a really long time. Theoretically, PipeWire screen sharing should be fixed by rebasing to a newer version of Electron and repatching/upstreaming patches.
Contrasting Electron versions, Element, a Matrix client leveraging Electron, uses a more recent version of Electron. By following the same procedure to check the Electron version, we get: [...] Chrome/98.0.4758.141 Electron/17.4.2 Safari/537.36
. In other words: it uses Electron 17.4.2, which is based on Chromium 98.0.4758.141. Just as a reminder, the Discord client uses Electron 13.6.6, which is based on Chromium 91.0.4472.164.
In my experience, Element works a lot better than Discord on Wayland. Newer Electron versions have many Wayland and PipeWire specific fixes. I can easily screen share with my friends with Element on Wayland and I can reliably use it on the Wayland backend without it crashing. If we look at the changelogs between Electron 13.6.6 and 17.4.2, there are a few Wayland related changes. Some examples are:
[…]
- Fixed to ensure that chromium bind