How to change the order in which update-desktop-database puts the applications supporting a mimetype

xdgxdg-open

I am running manjaro linux which is built on top of Arch Linux. I use cinnamon desktop environment occasionally and Awesome for the rest.

I am trying to figure out how I can get the system to choose the defaults differently when I install several packages that support a certain mime-type. For example, on my system I have pcmanfm, nemo and sunflower all of which handle inode/directory. By default, the update-desktop-database generates a line like below in /usr/share/applications/mimieinfo.cache which makes sunflower the default.

inode/directory=sunflower.desktop;pcmanfm.desktop;nemo.desktop;

I can override this by adding entries in .config/mimeapps.list but my question is about if I can influence the order of the entries in the system-wide defaults.

In this case, e.g, I like sunflower a lot but when I am opening folders from other applications (e.g., deluge) I want them to be opened in PCMan File manager. Ultimately these apps use xdg-open which uses the mimeinfo.cache or one of the overrides to launch the right handler.

How can I change the order in which these applications are listed in the mimeinfo.cache ?

Best Answer

You can not change the order (see also https://bugs.freedesktop.org/show_bug.cgi?id=71932).

To change the default application system-wide you have to create a file /usr/share/applications/mimeapps.list. For example if you want that all PDF files will be opened with MuPDF add:

[Default Applications]
application/pdf=mupdf.desktop

I am not sure if you are still looking for an answer but I asked myself the same question and thought that my findings might also help others.

Related Question