fix: let Electron select the Wayland display - #4268
Merged
KristjanESPERANTO merged 2 commits intoSep 26, 2026
Merged
KristjanESPERANTO merged 2 commits into
KristjanESPERANTO merged 2 commits into
Conversation
WAYLAND_DISPLAY fell back to wayland-1 when unset, but that's not the real socket on every setup (wayland-0 on mine). With a saved pm2 env that never set WAYLAND_DISPLAY, electron connected to the wrong socket and SIGSEGV'd on every launch, and pm2's auto-restart turned that into a crash loop. Now it checks XDG_RUNTIME_DIR for the actual wayland-* socket first and only falls back to wayland-0 if it can't find one.
2 tasks
KristjanESPERANTO
approved these changes
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WAYLAND_DISPLAY falls back to wayland-1 when it's not set. On my Pi the real socket is wayland-0, so electron connected to nothing and crashed on every launch. Since pm2 auto-restarts the process, this turned into a crash loop that filled my disk with core dumps and broke git, npm and pm2 along with it.
This checks XDG_RUNTIME_DIR for the actual wayland-* socket and only falls back to wayland-0 if nothing is found.
Tested manually with a socket present, no socket, and WAYLAND_DISPLAY already set. Ran node --run lint:fix, no issues.