GIMP: MimeType overkill (the journey continues)

Still it opens in gwenview.

2 Likes

It would be nice to know what caused it on the OP’s computer… I don’t think it is a packaging issue.

Whether you click on an icon in Dolphin, click on a hyperlink in Konsole, or use xdg-open should not matter, it is all the same thing anyway.

I don’t think it is a packaging issue.

Then why does it happen on my vanilla Arch VM with LXQT?

It sounds almost like KDE introduced some workaround or something, which hasn’t affected my own EndeavourOS installation for some reason.

I’m looking at the source files of the GIMP package:

I’m not seeing anything that would cause that…

It takes the binary from here:
https://download.gimp.org/pub/gimp/v2.10/

Do you have a defaults.list file inside /usr/share/applications/ or ~/.local/share/applications/ ?

Because I don’t, neither in EOS nor the VM.

https://bbs.archlinux.org/viewtopic.php?id=97886

Nope, no file named defaults.list anywhere on my system.

2 Likes

Same.

1 Like

ok…

The problem went away at some point today, I have no idea what did it. I did not consciously change anything relating to MimeTypes on my system. I only installed virt-manager and some dependencies. But Gwenview was the default again.

But it immediately reappeared once I reinstalled GIMP (over the existing installation).

What the heck?

Edit: update-desktop-database seems to do it. So the issue is only some kind of transient glitch of installing GIMP with pacman that gets fixed when the mime cache is rebuilt. I guess I’ll set up a hook.

However, in the VM this method doesn’t work.

Indeed. That’s really odd… :confused:

1 Like

In any case, I’m fine with this workaround, so thanks for the help everyone.

I’m not gonna file the Arch bug, since it only seems to affect specific Arch setups and your fresh KDE installs don’t have it. If someone with LXQT who has this problem but doesn’t have vanilla Arch finds this thread and wants me to file the bug, let me know.

It would be nice to know exactly what causes it and how to reproduce it…

2 Likes

Thanks I didn’t know that you can use grep straight away on files. :pray:
I’ve been grepping wrong since a year. :sob:

2 Likes

It’s all right :laughing:

That’s a meme at that point:

We all :cat: into grep when starting…

2 Likes

Mine opens in Gwenview also.

Looks like file /usr/share/applications/mimeinfo.cache is updated sometimes by the system, e.g. when “an invalid MIME type is met” according to the man page of update-desktop-database.

Haven’t tested this, but maybe backing up that file (and restoring when these problems occur) might help? Probably needs also checking the differences e.g. with meld.

Edit: there’s also file ~/.local/share/applications/mimeinfo.cache. That might help too.

Edit2: used thunar file manager to change application bindings. That didn’t change any of those files, but worked in thunar anyway.

Hi! Not on Endeavour, but I got pointed to this thread from elsewhere, and I’m hoping I might be able to disentangle what’s going on a bit.

TL;DR: I think something (file manager? desktop?) is incorrectly treating the entries in mimeinfo.cache as an ordered list when they’re actually unordered.

mimeinfo.cache is supposed to be autogenerated, and regenerated whenever a desktop application is installed or removed. So manually editing/restoring it is not a practical long-term solution. It says which apps can open a given mimetype (like image/jpeg), but not anything about which app should be preferred. The man page for update-desktop-database (the command to generate this file) is clear that the order doesn’t mean anything:

The order of the desktop files found for a MIME type is not significant. Therefore, an external mechanism must be used to determine what is the preferred desktop file for a MIME type.

In fact, it doesn’t even produce a consistent order. So if something takes the first application for image/jpeg in that file, you get pot luck each time it’s regenerated (which can be when any application is installed, even if it’s nothing to do with images). Edit: looks like this actually got fixed a couple of years ago, so it shouldn’t be random. Of course, ‘gimp’ sorts before ‘org.kde…’, so if something is relying on the order there, it won’t give you the result you want.

If my guesswork is correct, I’d be most inclined to file a bug against the desktop/file manager that’s choosing the application: if there isn’t a default application, it should either prompt the user to pick one, or at least make a consistent choice that doesn’t depend on the random order in mimeinfo.cache.

At the distro level, you can address this by defining default applications in a mimeapps.lst file. Fedora does this in a very Gnome-focused way, but the mime-apps spec allows for more subtle approaches - defaults can be given in a priority order (to use the first available one), and you can have different defaults for different desktops with files like kde-mimeapps.lst. Naturally, user preferences (especially ~/.config/mimeapps.lst) override the system-provided defaults.

7 Likes

Welcome to the forum, and thank you for the explanation!


EDIT:

However, I am not convinced you’re completely correct. Just looked at my mimeinfo.cache for the entry for image/gif and this is what I have:

image/gif=gimp.desktop;okularApplication_kimgio.desktop;org.kde.gwenview.desktop;org.kde.mobile.okular_kimgio.desktop;

As you can see, Gwenview is somewhere in the middle of the list. The order should not matter. And it doesn’t, because Gwenview correctly opens gif files on my system. If some component of my system treated this as an ordered list, then it would use either the first or the last entry to open the file, not the one in the middle.

I have found no way to reproduce the issue the OP has.

4 Likes

Is it possible that you have a preference set in a mimeapps.list file somewhere? See this page for the list of locations where that file might be. You’re looking for [Default Applications] sections in each of those files.

I’d guess that it would only use the first one from mimeinfo.cache if it hasn’t found a default application from any of those mimeapps.list files.

(Not directly related, but I also just found that the Arch wiki has some good information about this: Default applications and XDG MIME applications).

2 Likes

There is no file named mimeapps.list on my entire system…

1 Like

~/.config/mimeapps.list ?
It should be created in case you’ve manually overriden Open with to some non-default program

4 Likes