xdg-mime configure the default applications for opening file types. A situation has forced me to learn their use.
I installed a mp3 tag editor. Somehow, it was assigned the default application to open files and folders on Void Linux. This meant when I clicked 'Open Containing Folder' in Firefox it opened every file in the mp3 tag editor. Obviously, not ideal.
Fixing it was as follows:
First, I needed to confirm what was set as the default program to open directories.
$ xdg-mime query default inode/directory org.kde.kid3-qt.desktop
Revealed that this was truly the culprit. So switching it back to my file manager (pcmanfm) was as follows:
$ xdg-mime default pcmanfm.desktop inode/directory
And the next time I went to Open the Containing Folder in Firefox, it worked!
List .applications for xdg-mime & xdg-open
If you want to check which applications are available to configure with xdg, look here:
$ ls /usr/share/applications/
You should see plenty of files ending in
.application. Any one of these may be assigned as a default application, in a manner like that noted above.
Find the mime-type for a file:
$ xdg-mime query filetype README.md text/plain
Then use the result, e.g.
text/plain, in your assignment of a
xdg-mime default to an application.
This is equivalent to
open on OSX. Simply run
./xdg_open <filename> and this will open the file in the default program, as assigned by xdg. I use this often when editing HTML in VIM and I quickly want to open the file in Firefox to see it visually.
- Guy Rutenberg's Blog