Re: Breaking programs because a not yet implemented solution exists in theory
Josselin Mouette <email@example.com> writes:
> Le mercredi 01 février 2012 à 01:14 -0800, Russ Allbery a écrit :
>> The description and nametemplate don't come from the same place. Those
>> come from /usr/share/mime/application/pdf.xml, and are the same for all
>> application/pdf entries.
> That, and also you have to take into account aliases (different MIME
> types characterizing the same file type) and subclasses (for example ODT
> is a subclass of ZIP, yet you want to prioritize OOo if it is installed
> to open it).
Actually, I don't think you have to take any of that into account when
translating to mailcap, since it doesn't have this concept. It has a
mapping of MIME types to applications, and that's it. If you don't have a
mapping for that particular MIME type, the only other option you have is a
wildcard, and only text/* is really meaningful. So I think you can just
ignore this property; mailcap just doesn't have any way of opening ODT
files with a ZIP viewer when OOo isn't installed.
It's been a long time since I've done mailcap, though.
> Yes, that’s where things become interesting. The freedesktop
> specification handles defaults, instead of priorities. In Debian, we
> take advantage of this to provide per-environment defaults. This way,
> you can prioritize GNOME applications over KDE ones when running GNOME,
> and vice versa. I don’t know if it’s possible to match that with the
> mailcap system.
It isn't. You get a system list and a user list, and that's all you get.
So there's no way to switch based on other system properties.
Well, you can use test to eliminate an application from consideration
entirely, but I don't think that fits for this.
That probably means that there's just no way to translate priority, and
you're going to have to guess or just take applications at random if
multiple applications with a desktop file manage the same MIME type. I
suppose you could apply a heuristic like using the application that has
the fewest MIME types it handles; I'm not sure if that's the right
The main place that mailcap is richer than the desktop file that I can see
is that mailcap allows you to express the exact command line (including
putting %s at different places if needed) and lets you specify different
commands for viewing, editing, and printing. For example:
message/rfc822; mutt -Rf '%s'; edit=mutt -f '%s'; needsterminal
I don't know if there's any way to do that with desktop files.
Also, I don't think there's a desktop equivalent of copiousoutput.
Russ Allbery (firstname.lastname@example.org) <http://www.eyrie.org/~eagle/>