From 4c867aa017a7ce2bf88138634b6d1e9a3bf34854 Mon Sep 17 00:00:00 2001 From: Ari Pollak Date: Mon, 4 Jul 2022 15:28:21 -0400 Subject: [PATCH] fix: Optionally remove DISABLE_WAYLAND for snaps via allowNativeWayland option (#6961) --- .changeset/stupid-kiwis-eat.md | 5 +++++ packages/app-builder-lib/src/options/SnapOptions.ts | 8 +++++++- packages/app-builder-lib/src/targets/snap.ts | 4 +--- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .changeset/stupid-kiwis-eat.md diff --git a/.changeset/stupid-kiwis-eat.md b/.changeset/stupid-kiwis-eat.md new file mode 100644 index 00000000000..4ef4ecf14eb --- /dev/null +++ b/.changeset/stupid-kiwis-eat.md @@ -0,0 +1,5 @@ +--- +"app-builder-lib": patch +--- + +fix: Optionally allow removing DISABLE_WAYLAND flag for snaps diff --git a/packages/app-builder-lib/src/options/SnapOptions.ts b/packages/app-builder-lib/src/options/SnapOptions.ts index ac418386fc5..e39b2a21744 100644 --- a/packages/app-builder-lib/src/options/SnapOptions.ts +++ b/packages/app-builder-lib/src/options/SnapOptions.ts @@ -50,7 +50,7 @@ export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions { /** * The list of [plugs](https://snapcraft.io/docs/reference/interfaces). - * Defaults to `["desktop", "desktop-legacy", "home", "x11", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"]`. + * Defaults to `["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"]`. * * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom plug `foo` in addition to defaults. * @@ -130,6 +130,12 @@ export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions { * Sets the compression type for the snap. Can be xz, lzo, or null. */ readonly compression?: "xz" | "lzo" | null + + /** + * Allow running the program with native wayland support with --ozone-platform=wayland. + * Disabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007 + */ + readonly allowNativeWayland?: boolean | null } export interface PlugDescriptor { diff --git a/packages/app-builder-lib/src/targets/snap.ts b/packages/app-builder-lib/src/targets/snap.ts index b170db4a8b5..2f7dd22c7cf 100644 --- a/packages/app-builder-lib/src/targets/snap.ts +++ b/packages/app-builder-lib/src/targets/snap.ts @@ -123,9 +123,7 @@ export default class SnapTarget extends Target { } else { const archTriplet = archNameToTriplet(arch) appDescriptor.environment = { - // https://github.com/electron-userland/electron-builder/issues/4007 - // https://github.com/electron/electron/issues/9056 - DISABLE_WAYLAND: "1", + DISABLE_WAYLAND: options.allowNativeWayland ? "" : "1", TMPDIR: "$XDG_RUNTIME_DIR", PATH: "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", SNAP_DESKTOP_RUNTIME: "$SNAP/gnome-platform",