5

I would like to revert to the default mime definitions at the system level, and also rebuild my local mime database. I am running Arch Linux KDE.

The Arch Wiki says,

If you use a desktop environment you should first check if it provides its own utility. That should be preferred over these alternatives.

Does KDE provide such a utility or should I use the generic xdg-utils?

The Arch Wiki mentions several mimeapps.list files, but I have never had those. Does KDE not use them?

The only mimeapps.list file I have had is ~/.config/mimeapps.list.

What is the procedure to put KDE's house in order in regard to mime types (for local user and system-wide)?

4

Does KDE provide such a utility or should I use the generic xdg-utils?

Yes, KDE read these mimeapps.list. The code is written in mimetypedata.cpp

KSharedConfig::Ptr profile = KSharedConfig::openConfig("mimeapps.list", KConfig::NoGlobals, QStandardPaths::GenericConfigLocation);

KDE would try to read them in this order

.config/kde-mimeapps.list
.config/mimeapps.list
/etc/xdg/kde-mimeapps.list
/etc/xdg/mimeapps.list
/usr/share/applications/mimeapps.list

Not having some of these files is not a problem because it depends on your KDE version and your distribution. KDE would consult whichever is found.

What is the procedure to put KDE's house in order in regard to mime types (for local user and system-wide)?

For local users, you can edit or create the files in your .config directory. Whereas, for system-wide use, you can create the ones in /etc instead.

However, most of the time there is no need to touch those files manually. You already have ~/.config/mimeapps.list created. If you want to change the application associated with any file extension just right-click -> Open With -> Other Application.... Choose your new application and tick the checkbox Remember application association for all files of type.... This would edit your ~/config/mimeapps.list for you. E.g, if you want to change PDF association to evince instead of okular, you do this and the entry

application/pdf=org.gnome.Evince.desktop;

would be added to your mimeapps.list. The application/pdf is guessed from /usr/share/mime/application/pdf.xml entry. So, feel free to learn the syntax this way or use xdg-mime instead. Here is the MIME applications associations specification

4
  • What tool or procedure is used to create these mimeapps.list files for KDE? Thank you for your detailed answer.
    – MountainX
    Jan 21 '20 at 18:30
  • 1
    @MountainX-for-Monica: I edited my previous answer so it also covers this new question. Jan 21 '20 at 19:13
  • Do you have any insight into my related question? unix.stackexchange.com/q/563102/15010 I'm still looking for an answer there. Thank you.
    – MountainX
    Jan 21 '20 at 22:15
  • 1
    @MountainX-for-Monica: Sure, I will try to help you there. Jan 22 '20 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.