20

When I download a file with firefox, it always asks me with what program I want to open it with, even when that type of file is recognized by the system, and I can double click on it in Nautilus and have it open properly.

This is an example with a deb file, which opens with Ubuntu Software center (as it should) when I double click on it in Nautilus.

enter image description here

I do not want to look for the required program in /usr/bin or whatever in the Firefox dialog, I want Firefox to recognize my system preferences. What I resort to doing now is choose "Download", open Nautilus and double click on the file...

Why can't Firefox recognize my system settings, and how do I get it to?

Thanks!

jfoucher
  • 23,534
  • Firefox has settings, to override the OS: Edit >> Preferences >> Applications. Do you want to adjust them to your needs, or just remove ALL? (I haven't tried this, so don't know consequences.) – david6 Nov 26 '11 at 00:09
  • It seems later Firefox versions might have improved this situation? Firefox 8 on my Xubuntu system here basically does what you're asking and I haven't done any special setup to it. – Caesium Dec 10 '11 at 04:16

4 Answers4

5

Use /usr/bin/xdg-open (it's part of xdg-utils package) to open all the files.

int_ua
  • 8,574
3

I can provide some perspective on why Firefox isn't more tightly integrated into Ubuntu. Applications like Firefox and OpenOffice/Libreoffice are designed to work on a wide variety of operating environments including various Linux distributions, Desktop environments, Windows OS, Apple OS and many others. All of those environments are moving targets. For example Gnome has gone to GTK 3.0 but not every application in the latest Ubuntu release has upgraded from GTK 2.0 and of course let's not forget Unity has entered the fray. To that end Firefox and their ilk loosely couple with operating environments so that development can focus on the core features of the application. Being all things to all people or for applications in this case all environments can be destructive to core goals. Clearly tight integration is conceivable and desirable from an individual user's perspective. It's a matter of priorities and complexity. The desirability of regular concurrent releases for all environments is also a factor.

fragos
  • 3,503
  • Why not have a bridge API that can be maintained by the OS or other interested parties and that Firefox will call it it's installed? – Scott Severance Dec 10 '11 at 09:54
  • It is likely that they use an intermediary interface internally. I'm not however familiar with their internal design and can't say that it constitutes a formal API or if your suggestion fits into the overall design structure. – fragos Dec 29 '11 at 09:23
2

There are different settings involved here:

  • What program Firefox proposes when downloading a file (as in the image posted in the question)

  • What program Firefox uses when accessing an online file

  • What program opens a file already downloaded when clicked in the Firefox downloads list.


For the first two options, the "Applications" settings under Preferences/Options (about:preferences as address) should do the trick (if it doesn't it is a bug and it should be reported as such).

Example for a deb file:

enter image description here

If the setting is to save, the file will be saved in Downloads or a selected location; if the setting is to open with an application, the file will be first saved anyway in a temporary location and then opened. If no program appears selected upon download try the above setting; if that doesn't work, try the below solution.


For the third case

(on how to make Firefox downloads list open a file in a desired application):

Some newly installed applications take over the "default" status in FF's about:preferences instead of the per-filetype normal application set at system level (e.g. Palemoon takes over as default instead of gwenview for jpeg files, Inskape or File Roller takes over instead of Okular for pdf file.).

"Always ask" is the choice that should be used in this case and then trying to create a per-user file ~/.local/share/applications/mimeinfo.cache with the lines:

[MIME Cache]
application/pdf=okularApplication_pdf.desktop

The disadvantage of the above is that it is a per-file-type setting. To have a solution for all files (as said in this answer), run:

cd .local/share/applications/
ln -s mimeapps.list defaults.list

In case this stops working: see that the undesired application is not again selected under about:preferences: be sure "Always ask" is selected there. Setting manually a different program (even the default for your file-type at system level, but which is not marked as "default" in the list for your file under about:preferences) might not work.

Tested in Firefox 60.0 in Kubuntu 18.04.


Something is not right with the Firefox settings. "Always ask" and "Save file" do not make sense for files already downloaded, therefore settings under about:preferences shouldn't affect the Downloads list. But they do. And they do in an inconsistent manner: only selecting the application marked as default is followed, switching to another application is not. To reverse that one might need to select "Always ask" and then follow the steps mentioned above.

  • This just saved my life. I was looking to solve the third case, opening a file from the downloaded files. In my case it was sufficient to delete the ~/.local/share/applications/mimeinfo.cache. Now it seems to be using xdg-open by default or by some other configuration i had made elsewhere at some other time... – Sunday Jul 02 '19 at 16:22
  • ..and what if after asking it still won't open (SELinux blocks for .tar.gz installs to /OPT)? Or some other app switches the association of .deb files to open it as an archive? – mckenzm Sep 30 '20 at 03:13
  • All the passive voice and text like "the undesired application" and "application marked as default" make this answer hard to understand. For the third option can someone who understands it reword it to be prescriptive, as in just "do this to fix"? Then provide explanation below that. – nmgeek Mar 27 '21 at 19:17
0

You should go to EditPreferencesApplications and decide what Firefox should do with every kind of files available. You can choose it to open with a certain application or to ask what to do.

That's the easiest, one click-way of doing it. Or you can use the dialog that appears (an that you have showed here), choose an application to open it and enable Do this automatically for files like this from now on. Next time you open one of these files it won't ask you again.

But I recommend the first solution.

hingev
  • 6,596
canhoto
  • 211
  • 3
  • 6
  • 2
    This doesn't answer the question. The question was how to make Firefox follow the system settings. It seems that Firefox instead wants to have its own file associations. Granted, it's been that way since at least the days of Netscape 3 in the mid-90s, but it's an insane way of operating. The options should be: Open with the default program; Save; Ask – Scott Severance Dec 10 '11 at 04:17
  • Yes, it does answer it: you change what's shown in the download dialog and also in the FF application preferences by actually choosing a program to open a download. After doing so, the program will appear in the lists and can be chosen to be the automatic handler. – kreemoweet Jan 20 '17 at 22:02