Repository navigation
Labels
33-x-y34-x-ybug 🪲has-repro-gistIssue can be reproduced with code at https://gist.github.com/platform/linux
Description
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 bug report that matches the one I want to file, without success.
Electron Version
33.3.0
What operating system(s) are you using?
Ubuntu
Operating System Version
24.04
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
Links open in the configured default browser
Actual Behavior
Links open in Chrome/Chromium instead, regardless of the configured default browser
Testcase Gist URL
Additional Information
This is a re-open of #42611 (by @bittylicious) after @Viicos was so kind to add a repro gist (adding a gist was an absolute requirement by the Electron team on the original issue).
The original issue already well pointed out that this issue seems to be new with Ubuntu 24 and wasn't present on 22.
Workarounds presented in in the original issue:
- Uninstalling all chrome/chromium (then e.g. a firefox will be correctly opened)
- Adding the following to
~/.local/share/applications/mimeapps.list
[Default Applications]
x-scheme-handler/http=firefox_firefox.desktop
x-scheme-handler/https=firefox_firefox.desktop
There are some additional details available in the original issue.
Reacted by Alexey Murz Korepov, Geoffrey Brossard, Evan Simkowitz, Silvio Donato, cshenrik, Austin Riedhammer, Victorien, Kolja Sam, Julie Mužina, Gareth Evans and 3 more
Metadata
Metadata
Assignees
Labels
33-x-y34-x-ybug 🪲has-repro-gistIssue can be reproduced with code at https://gist.github.com/platform/linux
Type
Projects
- StatusShow more project fields👀 Unsorted Items
- StatusShow more project fields👍 Does Not Block Stable
Activity
mlaurencin commentedon Jan 6, 2025
As I mentioned in the closed issue, the provided gist produced the expected behavior on Windows, so this is most likely a Linux only issue.
t3chguy commentedon Jan 6, 2025
Viicos commentedon Jan 6, 2025
This wasn't the reason the original issue was closed, but rather because it was missing a simple reproducible example (as mentioned here).
bittylicious commentedon Jan 6, 2025
Thank you for doing this @NobodysNightmare @Viicos .
This is just a grumbling response as it would have affected everybody who uses Firefox as their default browser, on the latest stable Ubuntu, yet the original issue was closed even though it is easy to reproduce. This must affect thousands of people and likely lose Firefox a lot of "default browser" settings, which sucks when Chrome has such market share.
geoffreybr commentedon Jan 11, 2025
I faced the same with web links but also when opening PDF files from the desktop client of @tutao based on Electron. The PDF files were opened by calibre (ebook reader) instead of evince pdf reader whereas evince is set as the default pdf reader...
Same workaround, adding this to
~/.local/share/applications/mimeapps.list:If someone face the same issue with other files, you can look in
/usr/share/applications/gnome-mimeapps.listfor references with mime types.Clicking on links has the expected behavior on other apps which are not based on Electron (pdf reader, other e-mail clients, text editor, etc.) so it looks related to Electron and not Ubuntu.
esimkowitz commentedon Jan 16, 2025
I did some digging into this, I believe the cause for this is that Electron sets the
XDG_CURRENT_DESKTOPenvironment variable toUnityfor Linux systems. They preserve the original value inORIGINAL_XDG_CURRENT_DESKTOP. I've tested and confirmed that restoring the original value before callingelectron.shell.openExternalmakes it honor the system defaults.This gets a very brief callout in the Electron docs. They claim this is to improve Chromium compatibility and I have no reason to doubt that, but it seems like a bug/unexpected behavior for
electron.shell.openExternalandelectron.shell.openPathto not honor the original value.Correct XDG_CURRENT_DESKTOP env var (#1754)
esimkowitz commentedon Jan 21, 2025
I'm admittedly a noob in the Electron codebase and it's been forever since I've touched C++, but it seems like the overridden
XDG_CURRENT_DESKTOPenv var is used elsewhere in Chromium so it needs to be preserved, butshell/common/platform_util_linux.ccis not dependent on it. It seems like theXDGUtilfunction inshell/common/platform_util_linux.ccis the right place to correct this, as it seems like all the functions that call this are ones that should honor the system default. I think the following should work for overriding the original value, but I'm curious to get input from an Electron maintainer. @mlaurencin @clavinelectron-issue-triage commentedon Apr 22, 2025
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!
NobodysNightmare commentedon Apr 22, 2025
Hello electron bot, thanks for trying to be helpful. The associated PR to this issue still has recent activity (4 days ago) and the problem still exists.
Correct XDG_CURRENT_DESKTOP env var (wavetermdev#1754)
charlag commentedon Sep 25, 2025
Hi, it doesn't look like the fix works for us:
tutao/tutanota#9696
When we run
shell.openPathit doesn't use the default app under Ubuntu 24.04 w/ GNOME, we have the same situation on multiple machines.We have tried manually replacing it with
and it does work which makes us question whether the fix actually does anything. We tried looking at the
XDGUtilbut it's hard to tell if there's a bug somewhere without debugging.charlag commentedon Sep 25, 2025
We have made a quick test with replacing
xdg-opencommand in path with our own custom script and sure enough,$XDG_CURRENT_DESKTOPisUnityso we are pretty sure that something about the fix does not work (anymore)