electron: [Bug]: Electron propagates GDK_BACKEND=x11 to subprocesses, breaking shell.openExternal with Firefox on Wayland
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Electron Version
12.0.9 13.0.1 14.1.0 15.1.1
What operating system are you using?
Other Linux
Operating System Version
NixOS 21.05
What arch are you using?
x64
Last Known Working Electron version
12.0.0-beta.20
Expected Behavior
shell.openExternal("https://electronjs.org/")
opens a browser tab at https://electronjs.org/. (My browser is Firefox on Wayland with MOZ_ENABLE_WAYLAND=1
, and has other tabs already open.)
Actual Behavior
Firefox shows this error and does not open a tab:
“Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile.”
Testcase Gist URL
https://gist.github.com/31ec2165f4aa806536e11d7d99d1e26f
I bisected this to v12.0.0-beta.20…v12.0.0-beta.21 (9faf23509d054062def1332500c05c8ee7fb9bb7…5dbb6356effbfc0f6e0528583fae832290c14207).
The difference between v12.0.0-beta.20’s working invocation of xdg-open
and v12.0.0-beta.21’s failing invocation is that the latter has GDK_BACKEND=x11
in the environment. I confirmed that this is responsible for the failure with manual invocations of
xdg-open https://electronjs.org/ # works
env GDK_BACKEND=x11 xdg-open https://electronjs.org/ # fails
I don’t know if Electron or Chromium need to set GDK_BACKEND=x11
for their own purposes, but it definitely should not be propagated to subprocesses such as xdg-open
.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 11
- Comments: 19 (12 by maintainers)
Commits related to this issue
- Revert GDK_BACKEND to work around Electron shell.openExternal bug. https://github.com/electron/electron/issues/28436 Signed-off-by: Anders Kaseorg <anders@zulip.com> — committed to zulip/zulip-desktop by andersk 3 years ago
- ferdi: 5.6.0-beta.5 -> 5.6.0-beta.6, improve XWayland support ChangeLog: https://github.com/getferdi/ferdi/blob/1886c8abed32e33f0f547c069c674b79279cf931/CHANGELOG.md#560-beta6-2021-05-31 Even though... — committed to Ma27/nixpkgs by Ma27 3 years ago
- ferdi: 5.6.0-beta.5 -> 5.6.0-beta.6, improve XWayland support ChangeLog: https://github.com/getferdi/ferdi/blob/1886c8abed32e33f0f547c069c674b79279cf931/CHANGELOG.md#560-beta6-2021-05-31 Even though... — committed to NixOS/nixpkgs by Ma27 3 years ago
- fix: do not propagate GDK_BACKEND env variable to subproc fixes https://github.com/electron/electron/issues/28436 — committed to bavulapati/electron by codebytere 3 years ago
- fix: do not propagate GDK_BACKEND env variable to subproc fixes https://github.com/electron/electron/issues/28436 — committed to bavulapati/electron by codebytere 3 years ago
- fix: do not propagate GDK_BACKEND env variable to subproc fixes https://github.com/electron/electron/issues/28436 — committed to bavulapati/electron by codebytere 3 years ago
- fix: do not propagate GDK_BACKEND env variable to subproc fixes https://github.com/electron/electron/issues/28436 — committed to bavulapati/electron by codebytere 3 years ago
- fix: do not propagate GDK_BACKEND env variable to subproc fixes https://github.com/electron/electron/issues/28436 — committed to bavulapati/electron by codebytere 3 years ago
- fix: do not propagate GDK_BACKEND env variable to subproc fixes https://github.com/electron/electron/issues/28436 — committed to bavulapati/electron by codebytere 3 years ago
Still an issue in 26.3.0, 27.0.0-beta.9, and 28.0.0-nightly.20231009. Still wilting for #29606/#32929.
Still broken in 24.1.2, 25.0.0-alpha.4, and 26.0.0-nightly.20230421. Still waiting for #29606/#32929.
Just ran into this with VSCodium 1.56. Is there a workaround until this is properly fixed?
EDIT: Workaround: Add
/usr/local/bin/xdg-open
(assuming/usr/local/bin
is in yourPATH
) withand make it executable (this is assuming you don’t sometimes need that value, of course).
Stoppp it, bot.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, “bump”), and we’ll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
The fix in #28898 was reverted in #29610, and has not yet been reapplied in #29606. This still reproduces in 14.1.0 and 15.1.1. Please reopen.
Yup that is correct, I did mean removing the environment set by chromium in the parent process.