[PATCH] smart defaults per MIME heuristic
Submitted by Stanislav Brabec
Assigned to Hans Petter Jansson @hpj
Description
Created attachment 38726 desktop-file-utils-generate-defaults-list.patch
In the default system, the defaults.list has to be created manually. Keeping it up to date requires lot of maintenance time. That is why I implemented a heuristic that allows to define defaults in a simple and straighforward way:
-
If desktop file is assigned to a particular MIME type, it is used.
-
If any desktop file is marked as Preferred, it will be used, if 1. cannot apply.
-
If any desktop file is marked as Default, it will be used, if 1. and 2. cannot apply.
-
If any desktop file matches defined Categories and supports particular MIME type, it will be used if 1.-3. cannot apply.
Such heuristic allows to define smart defaults in just a few lines.
Notes:
-
The implementation supports {ENVIRONMENT}-defaults.list. These per-environment defaults are not yet supported by any application, but I am working on a patch for GLib.
-
The implementation is just a rewrite of SUSEconfig.glib2 heuristic to C language. It was used in openSUSE and SLE for creating of defaults.list for several year.
-
See TODO file for ideas for possible improvements.
Patch 38726, "desktop-file-utils-generate-defaults-list.patch":
desktop-file-utils-generate-defaults-list.patch