diff --git a/docs/tutorial/snapcraft.md b/docs/tutorial/snapcraft.md index 09e7a7830c..1b978b81d6 100644 --- a/docs/tutorial/snapcraft.md +++ b/docs/tutorial/snapcraft.md @@ -91,14 +91,14 @@ version: '0.1' summary: Hello World Electron app description: | Simple Hello World Electron app as an example -base: core18 +base: core22 confinement: strict grade: stable apps: electron-packager-hello-world: command: electron-quick-start/electron-quick-start --no-sandbox - extensions: [gnome-3-34] + extensions: [gnome] plugs: - browser-support - network @@ -237,6 +237,34 @@ apps: desktop: usr/share/applications/desktop.desktop ``` +## Optional: Enabling desktop capture + +Capturing the desktop requires PipeWire library in some Linux configurations that use +the Wayland protocol. To bundle PipeWire with your application, ensure that the base +snap is set to `core22` or newer. Next, create a part called `pipewire` and add it to +the `after` section of your application: + +```yaml + pipewire: + plugin: nil + build-packages: [libpipewire-0.3-dev] + stage-packages: [pipewire] + prime: + - usr/lib/*/pipewire-* + - usr/lib/*/spa-* + - usr/lib/*/libpipewire*.so* + - usr/share/pipewire +``` + +Finally, configure your application's environment for PipeWire: + +```yaml + environment: + SPA_PLUGIN_DIR: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/spa-0.2 + PIPEWIRE_CONFIG_NAME: $SNAP/usr/share/pipewire/pipewire.conf + PIPEWIRE_MODULE_DIR: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/pipewire-0.3 +``` + [snapcraft-syntax]: https://docs.snapcraft.io/build-snaps/syntax [electron-packager]: https://github.com/electron/electron-packager [electron-forge]: https://github.com/electron/forge