-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Electron is setting itself to be the default application for text/html files on Linux #20382
Comments
Can you reproduce this with a test case smaller than Signal? (e.g. does this happen with a trivial Electron app?) |
Unfortunately I suspect this may be an issue with
I just tried reproducing with a fresh installation of Linux Mint 19.2. I installed |
OK, I'll close this then as it seems like it's not an issue with Electron itself. |
@nornagon We're having trouble tracking this down. Does electron expose any APIs to set the application as the default file handler for a given mime type? |
https://electronjs.org/docs/all#appsetasdefaultprotocolclientprotocol-path-args on linux, it just calls |
I'm also running into this issue and I straced signal:
So indeed, signal / electron set's itself as default html handler on each start |
This comment has been minimized.
This comment has been minimized.
Electron never invokes So something other than Electron is invoking |
xdg-settings calls xdg-mime |
Ah, I didn't realise that. If the method in Electron is being called you should be able to find an invocation that looks like |
yeah, see my comment at signalapp/Signal-Desktop#3602 (comment) apparently signal/electron calls
I'm not sure whether this is a bug in signal, electron or xdg-settings fwiw. I'm just posting my findings so far |
I found a remotely related bug that says:
And I can confirm that this does make a difference: $ xdg-mime query default text/html
firefox.desktop
$ xdg-settings set default-url-scheme-handler sgl signaldesktop.desktop
$ xdg-mime query default text/html
firefox.desktop I think this is in fact an electron bug. Maybe not something that they can necessarily fix, but certainly something that can be documented (probably in |
No, it should be in the documentation for this call: https://electronjs.org/docs/api/app#appsetasdefaultprotocolclientprotocol-path-args Called here - and why Signal Desktop re-registers itself on every startup, and not just on install: I think we can safely reopen this bug. |
Reading more about this, I think this is ultimately a |
That said, it seems reasonable to use a desktop file name without a dash, i.e. signal.desktop until this issue in |
I'm running into this bug for an app that is also using electron. I created the desktop file manually and it doesn't contain any dashes, so I'm not sure that the bug is in Any clue on what else could be happening here? What else could I look at? |
It looks like @argenos has found the source of the problem: https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/180 Since |
Another option could be to override the desktop environment detection using environment variables when calling i.e. set |
The bug also exists for me, using Obsidian, in the Awesome WM, so it is not only in Gnome 3. |
This is essentially a bug of #!/bin/bash
if [[ "$1 $2" == "set default-url-scheme-handler" ]]; then
DEFAULT_BROWSER="$(xdg-mime query default text/html)"
/usr/bin/xdg-settings "$@"
if [[ "$(xdg-mime query default text/html)" != "$DEFAULT_BROWSER" ]]; then
echo "Reverting the default web browser to $DEFAULT_BROWSER"
xdg-mime default "$DEFAULT_BROWSER" text/html
fi
exit 0
fi
exec /usr/bin/xdg-settings "$@" |
Just an additional fix for those looking for them. Got this bug recently on Ubuntu 22.04 using etcher. Couldn't find the problem using xdg-mime or xdg-settings (both had correct handler listed). Put @trustin script into my PATH as well, but still got the issue. (especially annoying as I am trying to learn Rust and everytime I do This, however, fixed the issue:
Voila! It worked. Hope this helps someone out there! pam |
Not intending to re-open this issue, just adding a comment that others might find useful. As others have mentioned, this seems to be caused by a bug in We use electron & electron-builder to package a customised version of element-desktop. The package generated by the upstream project includes a file called We tweaked the Our build script customises the build parameters in
and the relevant bits of the resulting package.json looks like this:
|
Preflight Checklist
Issue Details
v6.0.9
v4.2.2
Expected Behavior
Electron should not set itself as the default application for opening
text/html
files.Actual Behavior
We are having users reporting that Signal sets itself as the default application for opening
text/html
files, both on installation and again while re-launching, but we did not set this up. See signalapp/Signal-Desktop#3602To Reproduce
Via signalapp/Signal-Desktop#3602
The text was updated successfully, but these errors were encountered: