Open Bug 1663257 Opened 4 years ago Updated 1 year ago

Firefox doesn't use the xdg-based default on Linux to open files

Categories

(Firefox :: File Handling, defect, P5)

Firefox 82
Desktop
Linux
defect

Tracking

()

People

(Reporter: jmsharvey771, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: dupeme)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0

Steps to reproduce:

On my system, I have Gwenview for opening images and Okular for opening PDFs. In my KDE system settings, Gwenview is listed as the first option for opening images. In Firefox, when I open an image by downloading it and clicking on it from the downloads dropdown, it opens Okular.

Actual results:

When opening images, Firefox uses the first application in mimeinfo.cache. In my case, this is either Okular or Chromium, depending on if I have Chromium installed.

What I think is happening is that Firefox is using the first option in /usr/share/applications/mimeinfo.cache instead of the actual defaults. I believe this because if I install Chromium alongside Firefox, it becomes the first application in mimeinfo.cache and is then used by Firefox for images. This is the listing for PNGs in mimeinfo.cache with Chromium installed:

image/png=chromium.desktop;okularApplication_kimgio.desktop;org.kde.gwenview.desktop;org.kde.mobile.okular_kimgio.desktop;

If I run xdg-mime query default image/png, I get the correct application (org.kde.gwenview.desktop).

I am running Arch Linux with the latest Firefox Nightly. My desktop environment is KDE Plasma.

Expected results:

Firefox should open images with the default application for images. In my case, this is Gwenview.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Networking: Cache
Product: Firefox → Core

I am not sure if this is the right component. Let's try with file handling component.

Component: Networking: Cache → File Handling
Product: Core → Firefox

Correlation and causation are unfortunately still different - I'm pretty sure we don't read the cache file: https://searchfox.org/mozilla-central/search?q=mimeinfo.cache (no hits)

We do read mime.types - https://searchfox.org/mozilla-central/rev/35d927df97900a57ecb562ad13909e392440b0fb/modules/libpref/init/all.js#3400 / https://searchfox.org/mozilla-central/rev/35d927df97900a57ecb562ad13909e392440b0fb/uriloader/exthandler/unix/nsOSHelperAppService.cpp#413 , and the mailcap files. Goes through https://searchfox.org/mozilla-central/rev/35d927df97900a57ecb562ad13909e392440b0fb/uriloader/exthandler/unix/nsOSHelperAppService.cpp#760 .

I'm pretty sure there's a dupe of this but I can't find it, because somehow linux can't settle on a single searchable name for this stuff (freedesktop, xdg, gnome gio, gnomevfs / giovfs, whatever).

Anyway, I'd take a patch here but I don't know anyone who has time to work on this. If someone external was interested / wanted to volunteer, I'm happy to help - the relevant code mostly lives in https://searchfox.org/mozilla-central/source/uriloader/exthandler/unix/nsOSHelperAppService.cpp and the GIO equivalent ( https://searchfox.org/mozilla-central/source/uriloader/exthandler/unix/nsGNOMERegistry.cpp ).

Blocks: 296443
Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: dupeme
OS: Unspecified → Linux
Priority: -- → P5
Hardware: Unspecified → Desktop
Summary: Firefox doesn't use the default application on Linux to open files. Instead, it just uses the first option in /usr/share/applications/mimeinfo.cache → Firefox doesn't use the xdg-based default on Linux to open files

XDG is the former name (and still the unique shorthand) of freedesktop. The freedesktop group creates cross-desktop standards. Those standards are implemented by components of several Linux desktops, such as GNOME and KDE. gio/g*vfs are such components for GNOME.

So when you search how to hand-implement a spec or standard, you either use xdg or freedesktop. If you are already committed to some library/component to call into, you search that component’s docs.

You need to log in before you can comment on or make changes to this bug.