On Tuesday 29 January 2008, Stanislav Brabec wrote: > > It is a very complex task to create correct defaults.list using the > current format. For example (GNOME), you have to do manually: > > - Fill eog.desktop for all image MIME types mentioned in eog.desktop > > - Find all MIME types not mentioned in eog.desktop but opened by another > GTK/GNOME viewer and fill this viewer to these MIME types. > > - Find all MIME types not opened by any of above and fill generic image > viewer there. > > It is even a fragile task - if any of the image viewers is removed, > there is no way to find "second best fit" and application has to choose > randomly.
The above is exactly why applications should *NOT* touch defaults.list files IMHO. Those files exist to save the user's preference, possibly a sysadmin preference, but only that. Applications should simply install a .desktop file that describes them. In order for the default order of applications (i.e. without user configuration available) to be non-random, we (in KDE) use a InitialPreference field in the .desktop file, and the default application for a mimetype is the one with the highest initial preference number. You might say: but then every application will use 4 billion or more in that field, but I have actually never seen that happen (and this would be equivalent with app installers modifying defaults.list anyway, so no difference there). In practice people use reasonable numbers (between 1 and 10) and this feature allows KDE releases to come out with a predefined application order, which allows to make sure that the order isn't stupid: for instance, even though karbon can sort of import postscript files (so karbon.desktop mentions application/postscript), kghostview was a much better default application for viewing postscript; so we simply made sure that kghostview had a higher InitialPreference than karbon. This example also shows that InitialPreference really has to be per-mimetype supported in a given desktop file, not just for the whole desktop file (although that's good enough in 95% of the cases of course). Hence my suggestion in a previous mail, for a new section in .desktop files which defines per-mimetype initial preference: [InitialPreferences] text/plain=2 application/postscript=6 (this makes this application preferred over another app that has <6 for application/postscript, but if a third application handles text better then it will be used instead of this one). I would really like this clean solution (cleaner than kde's current hack for per-mimetype preference numbers) to be added to the desktop entry standard. -- David Faure, [EMAIL PROTECTED], sponsored by Trolltech to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org). _______________________________________________ xdg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xdg
