Skip to content

Commit

Permalink
fix: Optionally remove DISABLE_WAYLAND for snaps via allowNativeWayla…
Browse files Browse the repository at this point in the history
…nd option (#6961)
  • Loading branch information
aripollak committed Jul 4, 2022
1 parent a2a39ad commit 4c867aa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-kiwis-eat.md
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

fix: Optionally allow removing DISABLE_WAYLAND flag for snaps
8 changes: 7 additions & 1 deletion packages/app-builder-lib/src/options/SnapOptions.ts
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions packages/app-builder-lib/src/targets/snap.ts
Expand Up @@ -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",
Expand Down

0 comments on commit 4c867aa

Please sign in to comment.