lxqt / libqtxdg

Qt implementation of freedesktop.org xdg specs
https://lxqt.github.io
GNU Lesser General Public License v2.1
72 stars 35 forks source link

Problem with setting default apps with the GLib backend #218

Closed tsujan closed 4 years ago

tsujan commented 4 years ago

My work on https://github.com/lxqt/lxqt/issues/1513 was almost finished, when I found the following issue:

XdgMimeAppsGLibBackend::setDefaultApp uses the GLib function g_app_info_set_as_default_for_type(). The problem is that, apparently, GLib first reads ~/.config/lxqt-mimeapps.list to get the default apps (see GLib → gdesktopappinfo.cdesktop_file_dir_unindexed_read_mimeapps_lists()) but only writes to ~/.config/mimeapps.list to set the default apps (in g_app_info_set_as_default_for_type()).

Now, since the GLib backend doesn't touch ~/.config/lxqt-mimeapps.list, if it exists and contains some default apps, it couldn't really change those apps.

Moreover, IMO, we shouldn't touch ~/.config/mimeapps.list when setting default apps because it'll affect other DEs too.

@luis-pereira Am I missing something obvious here? I think there is a contradiction in GLib and libqtxdg inherits it.