Is it possible to customize the external applications available on "edit layer in an external app?"

Like perhaps launching MyPaint with an environment variable that defines a different directory for the .desktop files?

Or maybe edit the .desktop files I don’t want to have on MyPaint with something like “DoNotShowIn=X-MyPaint;” (deriving/“guessing” it from “OnlyShowIn=X-Geeqie;”, which, I assume, does kind of “the opposite”)

I’ve found it okay-ish/acceptable to actually edit the PNG associations and remove most applications, many of which are not even editors. I’ll probably really use this kind of file association more from MyPaint itself than for any other program or situation. I don’t even recall ever using this kind of thing in any other scenario anyway.
But Ideally you’d be able to customize it, rather than having always the whole system-wide range of associations to chose from. My configs are non-standard to a good degree, but I believe things like having even web browsers associated with PNG came from something standard that Debian or some program does by default, it’s unlikely something I’d set-up myself. The only other situation I actually use .desktop files is from within Geeqie, custom editors and file operations.

There are around a dozen issues related to this on the tracker. The current implementation is not very flexible, and relies on the user knowing how to configure xdg-stuff to get the result they want (and it’s not documented in the wiki). Additionally, it’s mostly broken on Windows. Not good.

If this kind of customization is added, the question is how to organize it, and the associated preferences.

Features that could be added:

  1. Manual entries
    User can type in a command or path to external app (manually, or using a file browser). These entries will be stored in the user preferences and can be removed/edited (either under a new tab in preferences, or directly in the list). Should probably be listed separately from other entries, or otherwise marked as being user-provided.

  2. Configurable exclusion lists
    User clicks on an x-button, and the associated external app is ignored (placed on an ignore list, where it can be subsequently unignored). Not 100% necessary in my opinion, but a nice-to-have. Trade-off is interface complexity and maintenance.

  3. Default options
    User uses only, say, GIMP or Krita for 90% of their external edits, so they should be able to avoid having to initiate the edits via the selection window, while still having the option to do so if necessary. Another nice-to-have, but with trade-offs similar to exclusion lists.

We also have the issue of not supporting automatic updates when editing externally on Windows, but I would consider that to be a separate problem.

Thoughts?

Xdg-association thing is somewhat nightmarish to me. Or maybe the fact that there are some deviations from it, or perhaps different XDG environment variables for different desktop environments.
IMO the ideal GUI would be something like having the layer context menu already presenting a sub-menu with selected/default applications, and perhaps an “open with…” by the end, to add more. In “preferences” somewhere, you could remove the defaults, and also put whatever you want.
I’m not that enthusiastic about the exclusion list method, but theoretically it could be “the same thing,” except that everything would be a default then. Kind of like how it is now, everything is “default,” so maybe it’s not any worse than it is now, but already an improvement, when you think about it.