GNOME Bugzilla – Bug 630171
[PATCH] desktop environment specific defaults.list
Last modified: 2018-05-24 12:46:08 UTC
Created attachment 170669 [details] [review] glib-mime-env-specific-defaults.patch In the current GIO implementation, only one defaults.list can be used. It makes impossible to have different defaults for GIO-based applications in KDE and GNOME. Attached patch makes possible to use desktop environment specific defaults.list files. Dependencies: GIO: gdesktopappinfo.c: improvement of MIME caching code must be applied before this patch bug 596192 desktop-file-utils: smart defaults per MIME heuristic https://bugs.freedesktop.org/show_bug.cgi?id=30214 How to test: 1. Install upper mentioned patches together with this one. 2. update-desktop-database --defaults-list 3. ssh -X localhost 3.1 DESKTOP_SESSION=kde nautilus --no-desktop nautilus will prefer KDE applications. 3.2 DESKTOP_SESSION=gnome nautilus --no-desktop nautilus will prefer GNOME applications. Discussion: Patch now uses $XDG_DESKTOP_PREFIX (in form "foo-" with trailing hyphen), if it is not set, then $DESKTOP_SESSION (in form "desktop" without trailing hyphen) Other possibilities to switch betweens desktops: Implement something like g_desktop_app_info_set_env() or use g_desktop_app_info_set_desktop_env() (It has now a bit different meaning.) Note that it seems that nautilus have a custom way to select defaults as well. See also discussion in https://bugs.freedesktop.org/show_bug.cgi?id=30214
Feature announced in the XDG list: http://lists.freedesktop.org/archives/xdg/2010-September/011625.html
Created attachment 170681 [details] [review] glib-mime-env-specific-defaults.patch Removing gfile.c chunk that was added by mistake.
Created attachment 179518 [details] [review] glib-desktop-specific-defaults2.patch Patch ported to the latest glib. Topics that are still opened: 1. Patch now uses $XDG_DESKTOP_PREFIX (in form "foo-" with trailing hyphen), if it is not set, then $DESKTOP_SESSION (in form "desktop" without trailing hyphen) The single variable discrimination of desktop environment was refused in past. So the topic either has to be raised again, or the patch should contain heuristic to detect GNOME, KDE, XFCE, LXDE, GPE separately. 2. It is not clean what should happen with mimeapps.list. Should it be desktop-environment specific? Should be there functions to manipulate all-desktop-environments defaults and this-desktop-environment defaults? Example: Should Nautilus set defaults for XFCE file browser as well? Should they be completely separated? Should there be functions to allow settings Open by default in GNOME and Open by default in all environments? 3. Should we implement something like g_desktop_app_info_set_env() or use g_desktop_app_info_set_desktop_env() (which has now a bit different meaning) to switch behavior on fly? 4. What name should be used for desktop specific mimeinfo.cache? Now it uses gnome-mimeinfo.cache, kde-mimeinfo.cache etc.
Created attachment 198868 [details] [review] glib-desktop-specific-defaults3.patch Rebased version of the patch that applies to the current git snapshot. It also fixes memory corruption in mime_info_cache_init_desktop_defaults() (insufficient allocation for modified copy of mime_info_cache_dir_item_spec_defaults_list).
I can't comment on the implementation, but I'm OK with the general idea.
It seems that glib got a different implementation: glib/gio/gdesktopappinfo.c: desktop_file_dir_unindexed_read_mimeapps_lists() now looks for %s-mimeapps.list, as specified in the latest "Association between MIME types and applications" specification: http://standards.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/347.