Skip to content

Commit f4d7924

Browse files
authored
fix: change default value of disable_wayland depending on electron version (in order to support electron >38) (#9337)
1 parent d193871 commit f4d7924

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.changeset/yummy-eels-fry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix: change default value of disable_wayland depending on electron version (in order to support elevtron >38)

packages/app-builder-lib/src/targets/snap.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ export default class SnapTarget extends Target {
135135
delete snap.plugs
136136
} else {
137137
const archTriplet = archNameToTriplet(arch)
138-
appDescriptor.environment = {
139-
DISABLE_WAYLAND: options.allowNativeWayland ? "" : "1",
138+
const environment: Record<string, string> = {
140139
PATH: "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH",
141140
SNAP_DESKTOP_RUNTIME: "$SNAP/gnome-platform",
142141
LD_LIBRARY_PATH: [
@@ -147,6 +146,20 @@ export default class SnapTarget extends Target {
147146
].join(":"),
148147
...options.environment,
149148
}
149+
// Determine whether Wayland should be disabled based on:
150+
// - Electron version (<38 historically had Wayland disabled)
151+
// - Explicit allowNativeWayland override.
152+
// https://github.com/electron-userland/electron-builder/issues/9320
153+
const allow = options.allowNativeWayland
154+
const isOldElectron = !this.isElectronVersionGreaterOrEqualThan("38.0.0")
155+
if (
156+
(allow == null && isOldElectron) || // No explicit option -> use legacy behavior for old Electron
157+
allow === false // Explicitly disallowed
158+
) {
159+
environment.DISABLE_WAYLAND = "1"
160+
}
161+
162+
appDescriptor.environment = environment
150163

151164
if (plugs != null) {
152165
for (const plugName of plugNames) {

0 commit comments

Comments
 (0)