xdg-Standards or „Why isn’t the Default Applications for Images in Thunar the Default Application in catfish too“

If you have different file managers, or you are using some search tool like catfish, you will sooner or later try to open some file and find out that it doesn’t open with the application you want.
Every good file manager allows you to set the Default Application for a filetype and even Firefox has some configuration for that, so you can chose which application opens a downloaded file. But why do we have to do this? Why can’t we do this globally?

And the answer is: We actually can do it globally, but the applications just don’t follow some basic standards.

The basic standard we should follow in the Unix world is the xdg-standard. This means that the applications have some .desktop files in /usr/share/applications and/or ~/.local/share/applications. A .desktop file contains just some basic informations like which MIME types the application can open, it’s name, the path of the binary and some description.
A basic .desktop file can look like this:

[Desktop Entry]
Exec=fehl %f
Comment=Simple Image Viewer

And we have some mimeapps.list which just says which application is the default for which MIME type. This file is in ~/.config/ and/or in /usr/share/applications/.
A mimeapps.list entry can look like this:

[Default Applications]

The whole standard is straight forward and easy to understand. But there are some problems. The standard changed over time. For example the location of the mimeapps.list file was in ~/.local/share/applications in an older version of the standard and it’s in ~/.config/ now.
And the exec keys changed too. You see the ‚Exec=fehl %f‘ in the example above? The %f is a key for the filename. So if you would open a file in the file manager and this .desktop file is the default for that filetype, the file manager would execute ‚fehl /full/path/to/file.ext‘.
Lets look at the list of those keys:

Here we see all the Deprecated keys. All major file managers still support some or all of them. Xdg-open and catfish doesn’t support them.

All of those things can lead to some problems. If you set your Default Application for a filetype in a file manager like Thunar, it will create a .desktop file for it in ~/.local/share/applications and it will set it as a default in .config/mimeapps.list. This is nice, but Thunar does support the deprecated flags, so if you use them, this Default Application can’t be used by xdg-open or catfish.
It’s easy to deal with those problems. If some application needs the old path for mimeapps.list, just make a link to the other path and never use the Deprecated keys.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s