Discussion:
The place of mimeinfo.cache in freedesktop specs
Роман Чистоходов
2017-04-21 19:57:31 UTC
Permalink
mimeinfo.cache is automatically generated file by update-desktop-database.
Is it part of some spec? When are desktop environments expected to
re-generate mimeinfo.cache?

E.g. I'm writing installation script and it also install .desktop file with
some new MimeType. Should I call update-desktop-database or expect DE to
rebuild it for me?

I also found that xdg-open does not take mimeinfo.cache files into account,
so applications that use xdg-open sometimes fail to properly open programs
associated with the url unless association is in mimeapps.list.
Maxwell Anselm
2017-04-24 13:59:52 UTC
Permalink
Post by Роман Чистоходов
I also found that xdg-open does not take mimeinfo.cache files into
account, so applications that use xdg-open sometimes fail to properly open
programs associated with the url unless association is in mimeapps.list.
If the standard is being followed, mimeapps.list is what xdg-open should be
reading from since it determines which application is the default opener of
each MIME type. mimeinfo.cache is only used as a shortcut to find all
applications associated with a MIME type (without re-scanning every
.desktop file); it should not be relied on to determine default
applications.

At least on Arch Linux, mimeinfo.cache is automatically rebuilt whenever
desktop applications are added/removed. I would expect that other
distributions work similarly.
Reuben Thomas
2017-04-24 14:07:05 UTC
Permalink
Post by Maxwell Anselm
If the standard is being followed, mimeapps.list is what xdg-open should be
reading from
xdg-open delegates by default to desktop-specific helpers such as
gvfs-open, kde-open, (Mac OS X) open etc.

It has a generic fallback to using xdg-mime, which itself uses
desktop-specific helpers, and has a fallback to File::Mimeinfo and
file.

Therefore, in general it's anyone's guess what it does, though
obviously for a specific user's installation it's possible to trace
which particular tool it uses, and what a given version of that tool
will do; and further, various DE's helpers will indeed use
mimeapps.list.
--
http://rrt.sc3d.org
Роман Чистоходов
2017-04-24 14:15:48 UTC
Permalink
In practice desktops usually provide some default associations even if
there're no any mimeapps.list (nor in home, nor global one). So I think
it's used as fallback mechanism. The question is whether it's described in
some spec or not. If it's not, then it should be since it's already
embraced by most desktops.
Same for mimeinfo.cache regeneration. Some desktops do that, other don't.
E.g. does your installation automatically rebuild mimeinfo.cache if you
just copy .desktop file to ~/.local/share/applications or do you need to
install it with some external program like desktop-install-file? Again,
conditions of mimeinfo.cache rebuilding should be part of some spec
(probably nonexistent yet).
Post by Роман Чистоходов
I also found that xdg-open does not take mimeinfo.cache files into
Post by Роман Чистоходов
account, so applications that use xdg-open sometimes fail to properly open
programs associated with the url unless association is in mimeapps.list.
If the standard is being followed, mimeapps.list is what xdg-open should
be reading from since it determines which application is the default opener
of each MIME type. mimeinfo.cache is only used as a shortcut to find all
applications associated with a MIME type (without re-scanning every
.desktop file); it should not be relied on to determine default
applications.
At least on Arch Linux, mimeinfo.cache is automatically rebuilt whenever
desktop applications are added/removed. I would expect that other
distributions work similarly.
Loading...