Firefox keeps asking for being set as default browser when GTK_USE_PORTAL=1 is set
Categories
(Core :: Widget: Gtk, defect, P3)
Tracking
()
People
(Reporter: shtetldik, Assigned: rmader)
References
Details
Attachments
(1 file, 1 obsolete file)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0 Steps to reproduce: According to KDE developers recommendation, I tried enabling native KDE dialog integration with Firefox using xdg-desktop-portal-kde, and noticed that Firefox keeps asking about being set as default browser on each startup. System: Debian testing Linux, Firefox 65.0b6. I installed: xdg-desktop-portal 1.0.3 xdg-desktop-portal-kde 5.14.3 Set in $HOME/.profile: export GTK_USE_PORTAL=1 Applications > Default Applications > Web Browser already set to Firefox. When GTK_USE_PORTAL is not set, it's not asking after first time. I also noticed, that Firefox normally remembers this setting after creating a NoDisplay .desktop file in $HOME/.local/share/applications Such as: $HOME/.local/share/applications/userapp-Firefox-IIJAUZ.desktop [Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application NoDisplay=true Exec=/opt/mozilla/firefox/firefox-bin %u Name=Firefox Comment=Custom definition for Firefox This is not visible in menu and not available to System Settings choice (because of NoDisplay=true), so I usually create another .desktop file there, to expose Firefox. Something like: $HOME/.local/share/applications/Firefox.desktop [Desktop Entry] Comment= Exec=/opt/mozilla/firefox/firefox %u GenericName=Mozilla Firefox Icon=/home/user/pictures/icons/firefox.png MimeType=application/x-www-browser; Name=Firefox NoDisplay=false StartupNotify=false Terminal=false TerminalOptions= Type=Application X-KDE-SubstituteUID=false X-KDE-Username= Categories=Network;WebBrowser; This way it can be selected in System Settings > Applications > Default Applications > Web Browser. Something between these two and xdg desktop portal goes wrong I suppose. Corresponding KDE bug https://bugs.kde.org/show_bug.cgi?id=402206 was closed and KDE developers suggested it's a Firefox issue. Can you please take a look?
Updated•6 years ago
|
I can confirm this with Fx 66.0.1 on Fedora using KDE Plasma 5.14.
It doesn't matter to which value GTK_USE_PORTAL is set, the bug occurs even if it set to 0. Unsetting it completely doesn't trigger the prompt anymore.
Updated•5 years ago
|
Comment 3•5 years ago
|
||
For portal we may use the same mechanism as for Snap:
It should work unless home dir read+write access is sandboxed.
Comment 4•5 years ago
|
||
Can you please try latest nightly? This can be also a dupe of Bug 1526243.
I tried nightly and was getting the same thing but I noticed that if I use firefox rather than firefox-bin the problem stopped. I went back to my installed stable and launched /usr/lib/firefox/firefox instead of through a desktop icon and it seems to have stopped.
I believe the difference is in the /usr/bin/firefox file which (I assume) is called from desktop icons. This is a script with this:
#!/bin/sh
export GTK_USE_PORTAL=1
exec _neon.firefox "$@"
I'm not sure what this is doing though.
(In reply to Martin Stránský [:stransky] from comment #4)
Can you please try latest nightly? This can be also a dupe of Bug 1526243.
Just tested it with nightly (69.0a1). It still keeps asking to be set the default browser on start, when GTK_USER_PORTAL=1 is set.
Correction I meant GTK_USE_PORTAL=1 in the previous comment, naturally.
Comment 9•5 years ago
|
||
Setting GTK_USER_PORTAL=1 to get KDE native dialog is generally not a good idea. The GTK_USER_PORTAL variable is used to detect if the app runs as a flatpak and that means it cannot use the native print dialog and look for mimetype handlers in Firefox.
Comment 10•5 years ago
|
||
So the GTK_USE_PORTAL
variable is only meant for Snaps and Flatpaks?
Comment 11•4 years ago
|
||
I could not reproduce this issue, I'm on Arch Linux and I'm using KDE Desktop Environment, I've created a custom application for firefox in /home/itsdrike/.local/share/applications/firefox.desktop
which overrides the original one. it's command is set to GTK_USE_PORTAL=1 /usr/lib/firefox/firefox %u
. I've not experienced any issues about firefox asking to be a default browser as it already was before I've set this option.
Comment 12•4 years ago
|
||
(In reply to ItsDrike from comment #11)
I could not reproduce this issue, I'm on Arch Linux and I'm using KDE Desktop Environment, I've created a custom application for firefox in
/home/itsdrike/.local/share/applications/firefox.desktop
which overrides the original one. it's command is set toGTK_USE_PORTAL=1 /usr/lib/firefox/firefox %u
. I've not experienced any issues about firefox asking to be a default browser as it already was before I've set this option.
Which distro are you on? I'm currently on KDE Neon
Comment 13•4 years ago
|
||
(In reply to ItsDrike from comment #11)
I could not reproduce this issue, I'm on Arch Linux and I'm using KDE Desktop Environment, I've created a custom application for firefox in
/home/itsdrike/.local/share/applications/firefox.desktop
which overrides the original one. it's command is set toGTK_USE_PORTAL=1 /usr/lib/firefox/firefox %u
. I've not experienced any issues about firefox asking to be a default browser as it already was before I've set this option.
Ignore my previous comment.
Comment 14•3 years ago
|
||
HI All,
In case of widget.use-xdg-desktop-portal is set to true, then firefox is not the default browser anymore.
It cannot be made default anymore, unless that value is false.
Comment 15•3 years ago
|
||
I think those two are not compatible with each other.
Comment 16•3 years ago
|
||
Confirm it on Firefox for Arch Linux 86.0 64 bit KDE.
After install xdg-desktop-portal and xdg-desktop-portal-kde package then set widget.use-xdg-desktop-portal to True, Firefox believe it isn't default browser although I've set it to default browser again and again. No related environment variable was set.
Comment 17•3 years ago
|
||
(In reply to miku84 from comment #14)
HI All,
In case of widget.use-xdg-desktop-portal is set to true, then firefox is not the default browser anymore.
It cannot be made default anymore, unless that value is false.
Did you use GTK_USE_PORTAL=1
AND enable widget.use-xdg-desktop-portal, or did you only enable the former?
Comment 18•3 years ago
|
||
Hi,
I tried all of it:
- MOZ_ENABLE_WAYLAND=1 MOZ_WEBRENDER=1 GTK_USE_PORTAL=1 firefox + widget.use-xdg-desktop-portal true: portal is not working, default browser not working. I think use portal is not needed anymore: https://www.reddit.com/r/kde/comments/hdquxl/how_do_i_make_firefox_open_files_on_dolphin/
- firefox with widget.use-xdg-desktop-portal true: portal working, default browser not working
- firefox with widget.use-xdg-desktop-portal true + do not check default browser, firefox is not default: portal working, but as firefox is not default, open links are not working
- firefox with widget.use-xdg-desktop-portal false: portal off, default browser works. I use this way, as it opens links, but portal is ugly.
Comment 19•3 years ago
|
||
The behavior "Firefox keeps asking for being set as default browser" is present in Firefox 89.0 (apt package version 89.0+build2-0ubuntu0.20.04.2 from Ubuntu repositories for "focal" release. GTK_USE_PORTAL=1
and widget.use-xdg-desktop-portal
is false
in about:config
.
Full OS info:
Operating System: KDE neon 5.21
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.3
Kernel Version: 5.4.0-73-generic
OS Type: 64-bit
Graphics Platform: X11
Processors: 8 × Intel® Core™ i5-8250U CPU @ 1.60GHz
Memory: 7.7 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Comment 20•3 years ago
|
||
Forgot to mention – this wasn't present in Firefox 88.0 for me.
Comment 21•3 years ago
|
||
The issue reappeared for me too on KDE Neon, however I'm pretty sure it started before the 89 update. Maybe one month ago or so.
Comment 22•3 years ago
|
||
This issue also appeared for me on Firefox 89, and it was not present previously on 88.
I am on Manjaro Linux with KDE plasma, with GTK_USE_PORTAL=1
set, to be able to use the KDE file dialog.
Comment 23•3 years ago
|
||
Hi,
Same here for me, using KDE Neon 20.04 (Firefox v89).
The eternal bug.
Comment 24•3 years ago
|
||
Still present in Firefox 90, KDE Neon 20.04.
Assignee | ||
Comment 25•3 years ago
|
||
Can reproduce (FF 94, Gnome, Fedora 35). Very odd bug, will look into it.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 26•3 years ago
|
||
So what's happening here is that GTK_USE_PORTAL=1
and widget.use-xdg-desktop-portal
activate two technically related but also independent features, mainly targeting sandboxed environments.
The portal for opening URIs is quite limited and apparently there's no system portal yet that would allow to set or even check the default app - and it's not clear to me that there will ever be such a portal. Likely the whole default browser feature should be disabled in sandboxed environments / when portals are used (see bug 1621913 and bug 1515136).
Then there is the file picker portal. This one appears to be a totally different story. AFAICS there's no strong reason to not use the portal, even in non-sandboxed environments, if it's available. The only real reason I can see is that we'd behave differently than other GTK based apps - and FF is very different anyway. This would make the default experience on DEs like KDE quite a bit nicer.
So I guess what we should do here is:
- split up the portal option into one for the filepicker and one for URIs (and maybe future ones)
- add detection that checks if the filepicker portal is available
- if so, enable it by default (with an option to force it off)
Martin, how does that sound to you?
Comment 27•3 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #26)
AFAICS there's no strong reason to not use the portal, even in non-sandboxed environments, if it's available. The only real reason I can see is that we'd behave differently than other GTK based apps - and FF is very different anyway. This would make the default experience on DEs like KDE quite a bit nicer.
As someone who enables GTK_USE_PORTAL=1
globally, I have to pour a bit of cold water on this.
GTK developers do plan to enable the portals by default, but they currently require the environment variable because portals sometimes cause functionality regressions.
For example, on Kubuntu Linux 20.04 LTS (what I'm running at least until 22.04 LTS comes out), the portal host is too old to support directory pickers, which causes the Flatpak version of Thunderbird's "save all attachments" option to display a file picker where the filter only allows you to click "Ok" if you've selected a directory, but the rest of the dialog interprets selecting a directory as "enter the directory in search of the file you want" and the only thing you can actually do is Cancel. Very confusing if you don't know the technicals of what's going on.
I'm also told that some bits of metadata (application icon?) are currently fed to the portal host via files only present when running sandboxed, though that one seems to either be specific to the GTK/GNOME portal host or minor enough that I haven't noticed a problem.
It's probably best to just do what GTK does for now when it comes to whether to use the portals by default.
Assignee | ||
Comment 28•3 years ago
|
||
Thanks for that insight. In that case I guess we should just disable the default browser functionality whenever portals are enabled (also fixing bug 1621913 and bug 1515136).
Comment 29•3 years ago
|
||
Yes, I think we should disable the default browser check in sandboxed environment as this is controlled by user anyway.
Updated•3 years ago
|
Comment 30•3 years ago
|
||
(In reply to Robert Mader [:rmader] (back on ~23. Nov) from comment #26)
Then there is the file picker portal. This one appears to be a totally different story. AFAICS there's no strong reason to not use the portal, even in non-sandboxed environments, if it's available.
Using the file picker portal in a non-sandboxed environment sonuds a good idea. Chromium recently added such a feature (https://chromium-review.googlesource.com/c/chromium/src/+/2992214). But I think that's another task than the original issue?
Comment 31•3 years ago
|
||
(In reply to Chih-Hsuan Yen [:yan12125] (UTC+8) from comment #30)
(In reply to Robert Mader [:rmader] (back on ~23. Nov) from comment #26)
Then there is the file picker portal. This one appears to be a totally different story. AFAICS there's no strong reason to not use the portal, even in non-sandboxed environments, if it's available.
Using the file picker portal in a non-sandboxed environment sonuds a good idea. Chromium recently added such a feature (https://chromium-review.googlesource.com/c/chromium/src/+/2992214). But I think that's another task than the original issue?
Given what I covered in my previous comment, I'd say that the current "defer to GTK's judgment" behaviour is a good position.
- It allows people to opt into it with
export GTK_USE_PORTAL=1
if the're willing to accept the potential for regressions like the example I gave. - Since the GTK devs do want to make it default eventually, it defers switching to "on by default" to people who are more aware of the progress on eliminating regressions.
- Not just relying on GTK to make the decision feels like it'd be another case of "Hey Google, Firefox is ignoring my filetype associations while Chrome defers to
xdg-open
and Just Works™. How do I fix that?"
Assignee | ||
Comment 32•3 years ago
|
||
Looks like the non-flatpak case was largely fixed in bug 1746559, which disabled printing via portal in non-flatpak environments. From here it's easy to do the same for mime-types. That should help people on e.g. KDE that want a native file picker.
Assignee | ||
Comment 33•3 years ago
|
||
The mime portal breaks checking and setting the default browser.
thus disable it by default, just like D135120 did for printing.
Comment 34•3 years ago
|
||
This seems worth doing regardless of whether we do D136076.
Comment 35•3 years ago
|
||
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e6e6714aa40a Check for default browser using xdg-settings before trying to use the protocol handler. r=stransky
Comment 36•3 years ago
•
|
||
Backed out changeset e6e6714aa40a (Bug 1516290) for causing valgrind failures
Log: https://treeherder.mozilla.org/logviewer?job_id=365134948&repo=autoland
perma tier2: https://treeherder.mozilla.org/logviewer?job_id=365139586&repo=autoland&lineNumber=45326
There were also some mass failures like:
https://treeherder.mozilla.org/logviewer?job_id=365136749&repo=autoland&lineNumber=3660
https://treeherder.mozilla.org/logviewer?job_id=365138877&repo=autoland&lineNumber=12175
which were green on the backout push
Backout: https://hg.mozilla.org/integration/autoland/rev/1ce9d23799c35921a9458d145a50b5a57f1baea4
Comment 37•3 years ago
|
||
Pushed by robert.mader@posteo.de: https://hg.mozilla.org/integration/autoland/rev/1985d591b133 Disable xdg mime portal in non-flatpack environments by default, r=emilio,stransky
Comment 38•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Updated•3 years ago
|
Updated•2 years ago
|
Comment 39•2 years ago
|
||
backout uplift |
Backed out changeset 1985d591b133 (Bug 1516290) for causing a functional regression in snap builds (Bug 1756083) a=backout
https://hg.mozilla.org/releases/mozilla-beta/rev/9e37658e45e4
Updated•2 years ago
|
Description
•