How to find/remove file associations for a certain program in KDE

file openingkde

I had a program installed on my Kubuntu system that was able to open a lot of different graphics file types and registered as default program for many of those file types. I have unistalled the program, but in the file associations it is still present and every now and then as I try to open a file from the file manager, it tries to launch the no longer existing program.

I could remove that association for the most often used file types via the file associations dialogue in KDE's settings menu. Unfortunately, in this dialog I can only search for a file type and see/edit the associated programs, but in this case, I would need to search for the program and see all file types that it is associated to.

Is there a way to achieve this? If not via the settings, maybe in some config file, where I can just remove all hints to that program?

Best Answer

KDE uses freedesktop.org's standard mimeapps.list files for associating MIME types (file types) to applications.

The lookup order for this file is as follows:

  • $XDG_CONFIG_HOME/$desktop-mimeapps.list
    • user overrides, desktop-specific (for advanced users)
  • $XDG_CONFIG_HOME/mimeapps.list
    • user overrides (recommended location for user configuration GUIs)
  • $XDG_CONFIG_DIRS/$desktop-mimeapps.list
    • sysadmin and ISV overrides, desktop-specific
  • $XDG_CONFIG_DIRS/mimeapps.list
    • sysadmin and ISV overrides
  • $XDG_DATA_HOME/applications/$desktop-mimeapps.list
    • for completeness, deprecated, desktop-specific
  • $XDG_DATA_HOME/applications/mimeapps.list
    • for compatibility, deprecated
  • $XDG_DATA_DIRS/applications/$desktop-mimeapps.list
    • distribution-provided defaults, desktop-specific
  • $XDG_DATA_DIRS/applications/mimeapps.list
    • distribution-provided defaults

In this table, $desktop is one of the names of the current desktop, lowercase (for instance, kde, gnome, xfce, etc.)

This is determined from taking the ascii-lowercase form of a component the environment variable $XDG_CURRENT_DESKTOP, which is a colon-separated list of names that the current desktop is known as.

Note that:

$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

These are plaintext, ini-style files that can be searched for a program of interest.

Related Question