Re: Breaking programs because a not yet implemented solution exists in theory
Andreas Tille <firstname.lastname@example.org> writes:
> Well, from my perspective I was bored the first time when xpdf came up
> when I was expecting evince. After purging xpdf I learned that see does
> not find any pdf viewer. Sorry if I did not realised any discussion
> seven monthes ago noch any one-line helpers.
> So were can I read about which one-liner should be added to what package
> to fix the problem you decided to force upon others.
So, I don't have a one-line script, but I generally agree with Josselin
that maintaining the same information in two places is a bad idea. The
basic idea of what needs to be done is to convert the information in the
desktop files into the equivalent of a /usr/lib/mime/packages file.
For example, /usr/share/applications/xpdf.desktop has:
Comment=View PDF files
application/pdf; /usr/bin/xpdf %s; test=test "$DISPLAY" != ""; description=Portable Document Format; nametemplate=%s.pdf; priority=6
application/x-pdf; /usr/bin/xpdf %s; test=test "$DISPLAY" != ""; description=Portable Document Format; nametemplate=%s.pdf; priority=6
Obviously, the first field comes straight from MimeType (and, in general,
from the list of values in MimeType). I think one has to make the
assumption that one can add %s after Exec in order to load a file, since
the desktop entry doesn't have an equivalent of the command. The test is
the same for any application that says Terminal=false.
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
The priority is a more interesting problem. I'm not sure how the desktop
specification assigns priorities when multiple applications can handle the
same MIME type.
This doesn't look like a trivial tool, but it looks possible to write.
What I'd do is teach update-mime how to handle desktop files as well and
then add a trigger for changes in /usr/share/applications.
Russ Allbery (email@example.com) <http://www.eyrie.org/~eagle/>