Bug 402206 - Firefox keeps asking for being set as default browser when GTK_USE_PORTAL=1 is set
Summary: Firefox keeps asking for being set as default browser when GTK_USE_PORTAL=1 i...
Status: RESOLVED UPSTREAM
Alias: None
Product: xdg-desktop-portal-kde
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Jan Grulich
URL: https://bugzilla.mozilla.org/show_bug...
Keywords: usability
Depends on:
Blocks:
 
Reported: 2018-12-16 20:23 UTC by Shmerl
Modified: 2019-06-25 14:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shmerl 2018-12-16 20:23:16 UTC
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.

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.
Comment 1 Shmerl 2018-12-16 20:27:02 UTC
To clarify the above. Without GTK_USE_PORTAL=1, Firefox remembers "default browser" setting by creating a NoDisplay .desktop file. Even with that file present, it's still asking when GTK_USE_PORTAL=1 is set.
Comment 2 Jan Grulich 2018-12-17 06:42:04 UTC
I don't think this has something to do with our portal implementation. I think the problem here is that with GTK_USE_PORTAL=1 Firefox probably thinks it's running in sandbox and tries to read the configuration in a different way or on a different place, no idea.
Comment 3 Shmerl 2018-12-17 06:43:33 UTC
I can file a Mozilla bug if you think that's something on the Firefox side.
Comment 4 Shmerl 2018-12-24 21:32:38 UTC
Opened Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1516290
Comment 5 Shmerl 2019-06-25 14:42:24 UTC
Comment by Jan Horak:

https://bugzilla.mozilla.org/show_bug.cgi?id=1516290#c9

> 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.