On Sat, 23 Oct 2021 at 10:48, Stefan Kangas <stefan@marxist.se> wrote:
Eli Zaretskii <eliz@gnu.org> writes:

> More generally, I'm not sure mailcap is the right tool for the job:
> its main purpose is to view attachments to email messages, where we
> generally have metadata (MIME etc.) which is not necessarily available
> for arbitrary disk files.

Isn't that just "file --mime-type -b"?  file is a BSD command AFAICT so
it should presumably be available almost everywhere.

I also see in the man page than a certain Reuben Thomas has been
involved in its development so maybe he has something to add here.  :-)

I agree with Eli that mailcap is not the right tool for the job.

file's MIME-type support is easy to fix for types that don't (yet) have a MIME type supplied; file is actively maintained and frequently released. Note that xdg-open won't use file on a system that has its own MIME-type handling, such as GNOME.

--
https://rrt.sc3d.org