3

Firefox tries to open downloaded *.bz2 archives in GIMP even though both xdg-open and nautilus open it with file-roller as intended. This only happens when clicking on the downward arrow next to the search bar and then clicking on the file, using Tools->Downloads from the menu works as intended.

$ xdg-mime query default application/x-bzip
org.gnome.FileRoller.desktop

In nautilus, "Open With" on the file also correctly shows "Archive Manager" as default application. Edit->Preferences->Applications is set to "always ask" for "Bzip archive" (setting it to Archive Manager doesn't help as well).

How can I get Firefox to open *.bz2 files with file-roller when clicking on the downward-arrow next to the search bar and then on the downloaded file?

Versions: Arch Linux 4.6.4-1, GNOME Shell 3.20.3, Firefox 47.0.1, Gimp 2.8.

Output of grep -e "bzip\|bz2" -C1 .mozilla/firefox/[ProfileFolder]/mimeTypes.rdf:

 <RDF:Description RDF:about="urn:mimetype:application/x-bzip2"
                   NC:value="application/x-bzip2"
                   NC:editable="true"
                   NC:description="Bzip-Archiv">
    <NC:fileExtensions>bz2</NC:fileExtensions>
    <NC:fileExtensions>boz</NC:fileExtensions>
    <NC:handlerProp RDF:resource="urn:mimetype:handler:application/x-bzip2"/>
    <NC:possibleApplication RDF:resource="urn:handler:local:/usr/bin/file-roller"/>
--
    <RDF:li RDF:resource="urn:mimetype:text/plain"/>
    <RDF:li RDF:resource="urn:mimetype:application/x-bzip2"/>
    <RDF:li RDF:resource="urn:mimetype:audio/mpeg"/>
--
  </RDF:Description>
  <RDF:Description RDF:about="urn:mimetype:handler:application/x-bzip2"
                   NC:useSystemDefault="true"
  • 1
    Does mimeopen also start file-roller on bz2 files? – Dmitry Grigoryev Aug 1 '16 at 10:16
  • @DmitryGrigoryev I don't have mimeopen on my system. – Konrad Höffner Aug 1 '16 at 11:11
2

In your firefox profile folder (normally something like ~/.mozilla/firefox/[......].profile), there is a file named mimeTypes.rdf. Open it with your favourite editor and edit it to achieve the desired behavior.

Such an addition could look liek this:

  1. search for a line with an opening <RDF:Description RDF:about="urn:mimetype:handler:application/x-bzip2" tag as content.
  2. Be aware that such a line can occur multiple times in the file and pick the one which encloses a <NC:possibleApplication RDF:resource="urn:handler:[....]"/> tag
  3. Edit this tag to not from something like <NC:possibleApplication RDF:resource="urn:handler:local:/usr/bin/gimp"/> to <NC:possibleApplication RDF:resource="urn:handler:local:/usr/bin/file-roller"/>
  4. Restart firefox and test
  5. If necessary adjust mimeTypes.rdf file further

It might be good to backup the file to be on the safe side

  • There was only one mention of gimp, connected to JPEG images and not to bzip2, which I deleted to be sure but the problem persists. – Konrad Höffner Aug 1 '16 at 13:24
  • @KonradHöffner My guess than is that gimp is not explicitly set in a <NC: possibleApplication .... tag but results to be run as sort of a default application (i.e. it would have a bz2 related tag setting ` NC:useSystemDefault="true"` which should be changed then)..... To achieve the desired behavior open bz2 with file-roller it should suffice to add the <NC:possibleApplication RDF:resource="urn:handler:local:/usr/bin/file-roller"/> in the last tag you find for <RDF:Description RDF:about="urn:mimetype:handler:application/x-bzip2". – humanityANDpeace Aug 1 '16 at 13:29
  • Even that didn't help :-( – Konrad Höffner Aug 1 '16 at 15:02
  • maybe could you add to your question the output of grep -e "bzip\|bz2" -C1 .mozilla/firefox/[yourProfileFolder]/mimeTypes.rdf which should allow to have a look to the file and tailer the answer patter. Alternatively look at kb.mozillazine.org/MimeTypes.rdf as this should document the feature you require. – humanityANDpeace Aug 1 '16 at 15:09
  • Sure! I added it to the question. – Konrad Höffner Aug 1 '16 at 15:28
0

Firefox also reads ~/.config/mimeapps.list (on Xubuntu 16.04 at least, might be in ~/.local/share/applications on Arch?).

I had application/octet-stream=gimp.desktop under [Default Applications] (and application/octet-stream=gimp.desktop;zathura.desktop;… under [Added Associations]). Downloads are often served with bad mime types, giving "octet-stream", so you'll actually have to check under Network in the Firefox console for what mime type you're getting.

Putting file-roller.desktop as the Default entry in that file improved life for me. You can also do it with this command:

xdg-mime default file-roller.desktop application/octet-stream
  • commenting out the line application/octet-stream entirely (add a semicolon in front) seems to solve the problem completely (maybe it falls back to reading the extension) and firefox opens stuff with the correct applications again. – qwazix Aug 17 '18 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.