Skip to content

Commit 1f66ea1

Browse files
committed
fix: fallback to X11 for Wayland on Linux in Snap sandboxes
1 parent c7ca19e commit 1f66ea1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

main.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ 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+
3039
/**
3140
* Settings
3241
*/

0 commit comments

Comments
 (0)