Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(linux): declare the portal, and name the backend that implements it
Etienne Lescotcd017e1294df
diff --git a/electron-builder.json5 b/electron-builder.json5index 35dde88ad..de7d586da 100644--- a/electron-builder.json5+++ b/electron-builder.json5@@ -168,6 +168,27 @@// libs média périphériques. Une install minimale ou un WM monté à la main n'a// aucune de ces garanties. C'est ce que le job `verify-linux-package` prouve// désormais à chaque build, en interrogeant le loader plutôt que cette liste.+ //+ // `xdg-desktop-portal` est la MÊME classe de bug, et le job ci-dessus ne la verra+ // jamais : il interroge ld.so, or un portail est un service D-Bus et n'apparaît dans+ // aucun DT_NEEDED. Toute la capture Linux passe par lui — X11 compris, le helper+ // n'a pas d'autre chemin — et sans lui l'app affiche l'erreur zbus brute (#324).+ //+ // Le déclarer ne suffit PAS à lui seul, et il faut le dire clairement plutôt que+ // laisser croire que la ligne referme le sujet : le frontend ne fait que router, et+ // l'implémentation de ScreenCast vient d'un backend qui dépend du bureau+ // (-gnome, -kde, -hyprland, -wlr, -gtk). On ne peut pas en choisir un ici sans se+ // tromper sur la moitié des machines. Ce que la déclaration achète, c'est que la+ // contrainte devient explicite au lieu d'être héritée par accident du métapaquet de+ // bureau, exactement comme les trois sonames au-dessus. Le reste est fait à+ // l'exécution par `portal.rs::portal_unavailable`, qui nomme le backend à installer —+ // et c'est la seule moitié qui couvre l'AppImage, qui ne déclare rien.+ //+ // Nom identique sur les trois distributions, mais NON vérifié en conteneur au moment+ // d'écrire ceci (pas de moteur disponible sur la machine). Ce qui le prouve, c'est+ // `verify-linux-package.sh` : il installe réellement le paquet dans une image nue, et+ // un nom qui n'existe pas y fait échouer la transaction — c'est précisément comme ça+ // que `http-parser` a été pris sur pacman, à la première exécution du job."deb": {"depends": ["libgtk-3-0",@@ -182,7 +203,8 @@"mesa-vulkan-drivers","libgbm1","libasound2",- "libgomp1"+ "libgomp1",+ "xdg-desktop-portal"]},"pacman": {@@ -218,7 +240,8 @@"vulkan-swrast","mesa","alsa-lib",- "libgomp"+ "libgomp",+ "xdg-desktop-portal"]},"rpm": {@@ -253,7 +276,8 @@"mesa-vulkan-drivers","mesa-libgbm","alsa-lib",- "libgomp"+ "libgomp",+ "xdg-desktop-portal"]},"win": {diff --git a/electron/native/pipewire-capture/src/portal.rs b/electron/native/pipewire-capture/src/portal.rsindex 33ed9f1f0..1d23e7670 100644--- a/electron/native/pipewire-capture/src/portal.rs+++ b/electron/native/pipewire-capture/src/portal.rs@@ -138,14 +138,39 @@ fn failed(context: &str, error: impl std::fmt::Display) -> PortalError {PortalError::Failed(format!("{context}: {error}"))}+/// `Screencast::new()` fails when nothing answers on the ScreenCast D-Bus+/// interface. That is almost never a fault in the session: it is a machine with+/// no portal BACKEND installed — invisible on any desktop that ships one, which+/// every distro's desktop metapackage does, and the norm on a minimal install or+/// a hand-assembled compositor.+///+/// This message is not a log line. `message()` is what the helper emits on+/// `portal-failed`, what `handlers.ts` turns into the IPC error, and what the+/// recorder finally shows in a toast — so the raw zbus text ("A portal frontend+/// implementing org.freedesktop.portal.ScreenCast was not found") reached the+/// user verbatim and read as an internal fault to the one person able to fix it.+/// Name the package instead, the way `d3d_linux::diagnose` names Mesa.+///+/// The list has to be a list. `xdg-desktop-portal` on its own only dispatches;+/// which backend implements ScreenCast depends on the desktop, so naming the+/// frontend alone would send someone to install the package they already have.+fn portal_unavailable(error: impl std::fmt::Display) -> PortalError {+ PortalError::Failed(format!(+ "no ScreenCast portal is available on this session ({error}). Screen capture on Linux \+ goes through xdg-desktop-portal, which needs the backend matching your desktop: \+ xdg-desktop-portal-gnome (GNOME), xdg-desktop-portal-kde (KDE Plasma), \+ xdg-desktop-portal-hyprland (Hyprland), xdg-desktop-portal-wlr (Sway and other wlroots \+ compositors), or xdg-desktop-portal-gtk (anything else). Install one, then log out and \+ back in."+ ))+}+/// Cheap, non-interactive probe: does this portal offer METADATA cursor mode?////// Split out from [`negotiate`] so the helper can answer that question — and/// emit `ready` — before anything raises a dialog.pub async fn cursor_metadata_supported() -> Result<bool, PortalError> {- let proxy = Screencast::new()- .await- .map_err(|error| failed("cannot reach org.freedesktop.portal.ScreenCast", error))?;+ let proxy = Screencast::new().await.map_err(portal_unavailable)?;let cursor_modes = proxy.available_cursor_modes().await@@ -161,9 +186,7 @@ pub async fn cursor_metadata_supported() -> Result<bool, PortalError> {/// process-global `OnceLock`, so the portal session stays open until this/// process exits — which is exactly the lifetime we want.pub async fn negotiate(cursor_mode: CursorMode) -> Result<PortalStream, PortalError> {- let proxy = Screencast::new()- .await- .map_err(|error| failed("cannot reach org.freedesktop.portal.ScreenCast", error))?;+ let proxy = Screencast::new().await.map_err(portal_unavailable)?;let cursor_modes = proxy.available_cursor_modes()diff --git a/technical-documentation/engineering/build-and-packaging.md b/technical-documentation/engineering/build-and-packaging.mdindex d7fbdd3c4..61f410023 100644--- a/technical-documentation/engineering/build-and-packaging.md+++ b/technical-documentation/engineering/build-and-packaging.md@@ -135,6 +135,8 @@ The exposure is instead handled at the source, which is the layer to prefer anywWhat remains host-supplied for the AppImage is the GTK/GLib/NSS stack, which no AppImage bundles — theme engines, GIO modules and pixbuf loaders all resolve against the host. `libvulkan.so.1` is already bundled at the AppImage root by electron-builder itself. For the Vulkan *driver*, which cannot be bundled, `d3d_linux::diagnose` names the Mesa package instead.+**One dependency class stays invisible to everything above**, and 1.9.3 adds it after #328: `xdg-desktop-portal`. All Linux capture goes through it — X11 included, the helper has no other path — but a portal is a D-Bus service, so it appears in no `DT_NEEDED` entry and `ldd` will never name it however bare the container is. It hid behind the same metapackage accident as the three sonames, and it is now declared on `deb`, `rpm` and `pacman`. Declaring it is only half the fix: the frontend merely routes, and the ScreenCast implementation comes from a desktop-specific backend (`-gnome`, `-kde`, `-hyprland`, `-wlr`, `-gtk`) that no `depends` list here can choose without being wrong on half the machines. The other half is `portal.rs::portal_unavailable`, which names those backends in the error the user actually sees — the same answer `diagnose` gives for the Vulkan driver, and the only one that reaches the AppImage.+### Testing without the build machine's advantagesEvery failure in this section shares one shape: **the machines we test on have more installed than the machines we ship to.** A developer box carries the Visual C++ Redistributable because Visual Studio put it there; a CI runner carries a newer glibc than the distros the README claims. Nothing run on either can reveal an absence, so "it works here" is not evidence about anything, however many times it is repeated.