How do I make Firefox 64 use the KDE file selection dialog?

By default, Firefox uses the GTK file selection dialog when you press, for example, Control+O to open a local file.

How does a Kubuntu user make Firefox use the KDE file selection dialog?


Edit: this question deals with Kubuntu 18.04. Users of Kubuntu 20.04 will find the experience very decent.


This is possible in Firefox 64 with the important caveat that it is currently buggy. See the edit below.

First, Kubuntu 18.04+ users need to install xdg-desktop-portal. Your system probably already has xdg-desktop-portal-kde installed by default.

  • To see if you like it, simply run GTK_USE_PORTAL=1 firefox

  • If you want to keep the KDE file selection dialog for Firefox, add export GTK_USE_PORTAL=1 to the end of your ~/.profile assuming your system doesn't use either ~/.bash_profile or ~/.bash_login. Neither ~/.bash_profile nor ~/.bash_login are present in a default Kubuntu installation. Log out and log back in.

This is an image of the GTK file selection dialog in Firefox 64:

GTK file selection dialog

And this is what the KDE file selection dialog looks like in Firefox 64:

Firefox 64 with KDE file selection dialog

Sources:

  • Firefox v64 can now use the KDE file selection dialog when run with GTK_USE_PORTAL=1

  • https://www.reddit.com/r/linux/comments/a59ip5/firefox_640_released/eblfwcb

  • https://pointieststick.wordpress.com/2018/12/16/this-week-in-usability-productivity-part-49/


Edit (thanks to the comments provided by cipricus):

  • There is currently a major issue with the "Save As ..." aspect. Users need provide the filename and the extension themselves. This can be difficult when one is downloading, for example, a .deb file from https://www.google.com/chrome/. Bug 402077 - SaveFile does not set the current_name may have addressed this issue to some extent.

  • Other usability issues relate to the file selection dialog defaulting to the root folder if a user sets Firefox to ask for the download destination.


In newer versions of Firefox, you can go to about:config and set widget.use-xdg-desktop-portal to true. It's much easier than setting the GTK_USE_PORTAL=1 environment varibable in the Firefox launcher.