Skip to content

Preferred application and xdg-mime default don't match

Hello,

I have asked a few months ago the same thing in the forums but have gotten no answer, so I am afraid this is indeed a bug. https://forum.xfce.org/viewtopic.php?pid=68502#p68502

I've associated text/plain with Mousepad as seen below:

rd9nxB9

And this works great, it's the default in Thunar etc. Except I'd expect

xdg-mime query default text/plain

to return mousepad too, but it says

wine-extension-txt.desktop

This is problematic: Applications may open the default editor for something programmatically using xdg-mime (I'm trying to do exactly this), and the resulting application is something the user does not want to see / has never configured! Is this a bug? What is going on?

Here is a more detailed log:

$ env XDG_UTILS_DEBUG_LEVEL=10 xdg-mime query default text/plain
Checking /home/phi/.config/mimeapps.list
Checking /home/phi/.local/share/applications/mimeapps.list
Checking /home/phi/.local/share/applications/xfce-defaults.list and /home/phi/.local/share/applications/xfce-mimeinfo.cache
Checking /home/phi/.local/share/applications/defaults.list and /home/phi/.local/share/applications/mimeinfo.cache
wine-extension-txt.desktop

In .config/mimeapps.list, there is Mousepad, but only as an "Added Association":

[Added Associations]
x-scheme-handler/http=xfce4-web-browser.desktop;
x-scheme-handler/https=xfce4-web-browser.desktop;
text/html=org.xfce.mousepad.desktop;firefox.desktop;

As far as I understand, this should not make it become the default. When I move it to [Default Applications], it is detected by xdg-mime too.

It is possible that I once manually edited mimepps.list, so maybe it's an exotic problem - or maybe not. Bug either way? How can those two tools show different results?

Please know that this has nothing to do with Wine. If I remove the Wine stuff from mimeapps.list, xdg-mime opens up Atom instead and so on. Still a mismatch.