Pages

2015-09-18

Mimetype problems

Environment: Slackware 14.1 + Openbox + spacefm 1.0.3

Problems: 

Wrong (already deleted etc) apps in filetype open with list + wrong epub icon.
1. Newer version of Spacefm looks for .desktop files in ~/.local/share/applications and rearranges things in mimeinfo.cache. Result - apps list for given file-type gets strange and occasionally irrelevant.
(How and what to do with mimetypes in Spacefm.)
2. xml file in /usr/share/mime shows one icon listed, filemanager shows something complitely unrelated. Why, is unknown to me.

Solutions:
1. All mime defaults should go to
- either .local/share/applications/mimeapps.list,
- or to .config/mimeapps.list.
Entries look like this, for example:
[Default Applications]
application/vnd.oasis.opendocument.text=libreoffice-writer.desktop;
application/pdf=qpdfview.desktop;


Moral: As long as something is not rewriting your .local/share/applications/mimeinfo.cache too frequenty - you can change things there. It's easier and more flexible, you can also tune what app appears in second, third or whatever place on the list.
BUT, mimeinfo.cache IS prone to be rewritten, so let's change the .list with Spacefm:
rightclick on file - open - choose app for default - rightclick on it - make it default.
The same way you can remove or add apps to or from your available handlers list.
And the same for all filetypes what are not yet defined (fun and giggles for 0.5-1 hour).

2. Changing mimetype icons can also be done manually or with Spacefm:
a) copy yourproblematic.xml from /usr/share/mime/applications to ./local/share/mime/applications/packages
There is a line with <general-icon name=.../> in it. Change it from general-icon to icon, and replace icon name with your favourite icon in  ~/.icons/yourtheme/mimetype/ folder.
Run update-mime-database ~/.local/share/mime
b) A bit easire way, with Spacefm - rightclick on file - open - rightclick on default app - pick line with ...xxx.xml - click. Spacefm copies xml file from /usr/share/mime to your .local/share/mime/packages and opens it in editor.
Edit it the same way as in a).
Done.