Skip to content

Commit e4603d1

Browse files
committed
fix: set environment variables for X11 and disable Wayland in Snap sandboxes
1 parent 1f66ea1 commit e4603d1

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

electron-builder.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ const config = {
77
base: 'core22', // Must match build server (currently Ubuntu 22.04)
88
grade: 'stable',
99
confinement: 'strict',
10+
environment: {
11+
ELECTRON_OZONE_PLATFORM_HINT: 'x11',
12+
ELECTRON_ENABLE_WAYLAND: '0',
13+
},
1014
plugs: [
1115
// REQUIRED for Electron desktop apps
1216
'desktop',

main.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ app.commandLine.appendSwitch('disable-color-correct-rendering'); // Prevents inc
2727
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required'); // Prevents requiring user interaction to play audio
2828
app.commandLine.appendSwitch('disable-http-cache'); // Disables clearing of the cache folder at each startup
2929

30-
// Electron v31+ prefers Wayland on Linux (via Ozone), but it's unavailable in Snap sandboxes.
31-
// This causes "Failed to connect to Wayland display: No such file or directory" at startup.
32-
// Fall back to X11 if Wayland is not the active session:
33-
const useWayland: boolean = process.env.XDG_SESSION_TYPE === 'wayland';
34-
35-
if (!useWayland) {
36-
app.commandLine.appendSwitch('ozone-platform', 'x11');
37-
}
38-
3930
/**
4031
* Settings
4132
*/

0 commit comments

Comments
 (0)