16

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?

DK Bose
  • 41,240
  • 22
  • 121
  • 214

2 Answers2

17

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

This way, other programs like Thunderbird will also use KDE dialogs.

Sources:


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.

Ganton
  • 385
  • 2
  • 11
DK Bose
  • 41,240
  • 22
  • 121
  • 214
  • 1
    is the problem with the need to untick `Automatically select filename extension ...` rather severe? should it be un-ticked every time? Are there some limitations with the default gtk interface? is thus Firefox displaying kde instead of gtk allover after that? –  Dec 19 '18 at 10:44
  • 1
    When I try to save a file, Kubuntu 18.04: **(A)** if in Preferences I have selected "Always ask you where to save" **(1A)** root location is selected by default, so that I have to change the location, **(2B)** when saving a file the window is not `Save as`, but `Enter name of file to save to...` so that I have to enter the full name not just the extension; **(B)**, if in Preferences "Save files to: Downloads" is selected, the file is saved automatically with its own name without problems (but without seeing the kde interface). –  Dec 19 '18 at 11:36
  • 1
    `provide the filename extension themselves` - that is: write it, not just select it from a list: do I really have to know extensions in order to download a file? I am supposed to know its extension before even downloading it: I find that a severe problem. –  Dec 19 '18 at 11:49
  • 1
    Thank you. As far as I'm concerned the bugs make it unusable because I don't see the kde dialog in other cases but the ones in which it is broken, namely "save as" (as automatic saving doesn't trigger kde interface at all). I imagine "open file" would be another case (and that should work), but I never use that. –  Dec 19 '18 at 13:58
  • I was interested in using this solution if it worked, but the gtk default is fine for me. I will not spend time on this now, especially that I'm not the man for bug reports at all and risk to give dubious info. I'll wait for the kde integration to become default. –  Dec 19 '18 at 15:42
  • Fair enough! I'll keep watching for developments. – DK Bose Dec 19 '18 at 15:49
  • This works with Firefox. Does not work with some GTK Applications, such as Darktable. Is there another fix? – Harper Aug 29 '19 at 08:39
  • 1
    #402077 is fixed at least in 20.04 – int_ua May 19 '20 at 05:23
  • What about **chromium**? – James Bond Nov 08 '20 at 16:43
  • Thank you, it worked for me after I added that variable to `~/.zshenv` – a3k Jun 14 '22 at 22:38
5

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.

Zren
  • 185
  • 1
  • 6
  • Very nice! It works immediately without restarting browser (tested it with `Ctrl+O` - open file - dialog). – Andrei Sinitson Feb 08 '22 at 11:09
  • Note: Other answers are useful if someone wants a way to make several programs (Firefox, Thunderbird, etc.) use KDE dialogs. – Ganton Apr 17 '22 at 07:41