Why not to use utilities from xdg itself?
To make Thunar the default file-browser, i.e. the default application for opening folders.
$ xdg-mime default Thunar.desktop inode/directory
to use xpdf as the default PDF viewer:
$ xdg-mime default xpdf.desktop application/pdf
This should create an entry
[Default Applications] application/pdf=xpdf.desktop
in your local MIME database
Your PDF files should be opened with xpdf now.
You can install and use perl-file-mimeinfo in the
extra repository to manage mimetypes.
Example to open all
/usr/bin/vendor_perl/mimeopen -d $file.pdf
or on other Linux distributions where
mimeopen is NOT in
/usr/bin/vendor_perl/ but is in one of the
$PATH directories :
mimeopen -d $file.pdf
and then, at the prompt, enter the application:
You could use something like this to generate the appropriate
xdg-mime commands for each of your
.desktop files and the mimetypes they contain, then execute the ones you like. Note
/usr/share/applications might have subdirectories.
find /usr/share/applications ~/.local/share/applications -iname '*.desktop' -print0 | while IFS= read -r -d $' ' d; do for m in $(grep MimeType "$d" | cut -d= -f2 | tr ";" " "); do echo xdg-mime default "'$d'" "'$m'" done done