-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed setting of default apps with GLib backend #219
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed it, but dismiss it. Never seen the $desktop-mimeapps.list
being used.
$XDG_CONFIG_HOME/$desktop-mimeapps.list | user overrides, desktop-specific (for advanced users)
$XDG_CONFIG_HOME/mimeapps.list | user overrides (recommended location for user configuration GUIs)
The standard seems to incentivize not using it. I took GLib implementation by reading it and not writing as a implicit statement that $desktop-mimeapps.list
was something that a advanced user would edit by hand.
- If we are going this way we must take
XDG_CURRENT_DESKTOP
into account. libqtxdg isn't LXQt specific (there are people using it). - Does this rationale also applies to
Added Associations
andRemoved Associations
? - Not sure about
changed
signal behavior. Will test.
It was a long long day, will continue tomorrow. Have to rest now.
src/qtxdg/xdgmimeappsglibbackend.cpp
Outdated
GDesktopAppInfo *gApp = XdgDesktopFileToGDesktopAppinfo(app); | ||
if (gApp == nullptr) | ||
return false; | ||
|
||
GError *error = nullptr; | ||
if (g_app_info_set_as_default_for_type(G_APP_INFO(gApp), | ||
mimeType.toUtf8().constData(), &error) == FALSE) { | ||
QString confDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can eat our own food and use XdgDirs::configHome()
. It also uses QStandardPaths
but shields us from changes in Qt itself.
I have no problem with that.
No, because they only use
Today was like 3 days to me ;) With these patches, I made default apps work at last. The only remaining challenge is finding a reliable way of restoring the previous settings. Honestly, |
In LXQt, although the GLib backend reads `~/.config/lxqt-mimeapps.list`, it writes to `~/.config/mimeapps.list` on setting default apps. Since we want to set default apps only for LXQt, the patch directly writes them to `lxqt-mimeapps.list` — after adding the needed associations to `mimeapps.list` (GLib always does the latter). The patch considers `XDG_CURRENT_DESKTOP` and works outside LXQt too. In other words, it isn't limited to `lxqt-mimeapps.list`. Fixes #218
5bbd5f6
to
b37e18a
Compare
Updated the patch to consider |
You mean the GLib implementation. I was referring to the standard.
|
I just supposed that GLib follows standards, knowing that Gnome devs have had a big part in implementing them. GLib does this: It gives priority to the DE-specific Apart from it, when GLib sets a default app, it adds the needed associations to the DE-independent |
GLib has a weird problem. On the one hand, `g_app_info_set_as_default_for_type()` writes to `~/.config/mimeapps.list`. On the other hand, the DE-specific list — e.g., `~/.config/lxqt-mimeapps.list` in LXQt — has priority over it and GLib respects that. Therefore, if the latter exists and contains some default apps, `g_app_info_set_as_default_for_type()` could not change them. This patch solves the problem by adding a utility function that sets the default app directly inside the DE-specific list. Also, see lxqt/libqtxdg#219.
GLib has a weird problem. On the one hand, `g_app_info_set_as_default_for_type()` writes to `~/.config/mimeapps.list`. On the other hand, the DE-specific list — e.g., `~/.config/lxqt-mimeapps.list` in LXQt — has priority over it and GLib respects that. Therefore, if the latter exists and contains some default apps, `g_app_info_set_as_default_for_type()` could not change them. This patch solves the problem by adding a utility function that sets the default app directly inside the DE-specific list. Also, see lxqt/libqtxdg#219.
GLib has a weird problem. On the one hand, `g_app_info_set_as_default_for_type()` writes to `~/.config/mimeapps.list`. On the other hand, the DE-specific list — e.g., `~/.config/lxqt-mimeapps.list` in LXQt — has priority over it and GLib respects that. Therefore, if the latter exists and contains some default apps, `g_app_info_set_as_default_for_type()` could not change them. This patch solves the problem by adding a utility function that sets the default app directly inside the DE-specific list. Also, see lxqt/libqtxdg#219.
In LXQt, although the GLib backend reads
~/.config/lxqt-mimeapps.list
, it writes to~/.config/mimeapps.list
on setting default apps. Since we want to set default apps only for LXQt, the patch directly writes them tolxqt-mimeapps.list
— after adding the needed associations tomimeapps.list
(GLib always does the latter).The patch considers
XDG_CURRENT_DESKTOP
and works outside LXQt too. In other words, it isn't limited tolxqt-mimeapps.list
.Fixes #218