[conspire] myopen(1)

Eric De Mund ead-conspire at ixian.com
Thu Mar 26 22:39:04 PDT 2009


begin Eric De Mund quotation of Thu, Mar 26, 2009 at 02:40:48AM -0700:
> 4a. There doesn't appear to be any agreement on how developers (of
>     GIMP, of evince, of xpdf, to speak of PDF-capable programs, for
>     example) should be touching mimeinfo.cache. Is it a complete free-
>     for-all? Is any program allowed to edit mimeinfo.cache, and put
>     itself first in line, as the preferred handler for a particular
>     type of file?

Don Marti <dmarti at zgp.org>:
] Have you looked at /etc/mailcap? There's a whole convention on how
] that gets built and updated by the package manager (at least under
] Debian -- other distributions must have something similar.)

Eric De Mund <ead at ixian.com>:
> 4b. Even if there are freedesktop.org project guidelines for applica-
>     tions on how and when they're to touch mimeinfo.cache, there
>     doesn't appear to be any way for me, the user, to weigh in with
>     a standing declaration of "If an entry (i.e. an application or a
>     list of applications) for file type 'application/foo' appears in
>     the file, please append rather than prepend yourself to that
>     entry/list." Again, not rocket science.

Don Marti:
] You can make your own ~/.mailcap file to override the system one --
] see man mailcap and the "run-mailcap" utility.
] Another useful trick for getting MIME types from files is "file -ib".

Very useful trick, this "file -ib" trick. I appreciate it; thank you.
Also thank you for mentioning run-mailcap(1); I was completely unfami-
liar with it.

Is my understanding correct, then? It seems that I could create a simple
2-step script to:

    1.  Determine a file's mime-type with "file -ib", e.g.
        %  file -ib family-dog.jpg

    2.  Feed that output to run-mailcap(1) so it needn't determine file
        type by file extension:
        % run-mailcap --action=view image/jpeg:family-dog.jpg

I tested this out by renaming family-dog.jpg to family-dog.txt, and the
feh(1) image viewer was nicely launched, just the same as it was for

Thinking out loud now, I think I only need to figure out a way to have
run-mailcap(1) *not* search /etc/mailcap and /etc/mime.types for appro-
priate info if it's not found in ~/.mailcap and ~/.mime.types.

Much obliged,
Eric De Mund   | Ixian Systems           | Jab: eadixian at jabber.org/main
ead at ixian.com  | 650 Castro St, #120-210 | Y!M: ead0002
ixian.com/ead/ | Mountain View, CA 94041 | ICQ: 811788

More information about the conspire mailing list