How can I remove all instances of a program from file associations?

In KDE, I can easily search for a file association and set the default and alternate programs used to open it. What I want to do is search for a program, and set the file types. Okay, what I really want to do is just wipe out all instances of certain programs.

Install any program with wine, and you get notepad added to the list for every flavor of text, plus Internet Explorer for everything web-related, one instance per program installed with wine! And aegisub, a subtitle editor for videos, also shows for everything having to do with text. Deleting them one-by-one from hundreds of file types is tedious, but is there a config file to edit? Then I could search-and-replace. As nearly as I can determine, the config files in home/.local/share/menu only show changes to the default, and I can’t find where the default is stored in the root system. /usr/share/applications/mimeapps.list is empty, and editing mimeapps.cache in the same directory makes no difference for the next new user profile.



Is it bad etiquette to answer my own question?

So that empty file I mentioned turns out to be the right one: /home/<username>/.local/share/applications/mimeapps.list.

If it doesn’t exist, create it, and add the lines

[Removed Associations]

Or whatever mimetype, or whatever app by the name of its desktop file.

I found a mimeinfo.cache file, and got the format for the desktop files. I just searched for wine, and copied every line where the mimetype didn’t include wine, but the desktop files did. For instance, the line “application/x-wine-extension-msp=wine-extension-msp.desktop;” should not go in removed applications because you’ll still want wine top open windows programs.

It should go without saying, but I want to be clear: If other apps showed up in the list for a mimetype, I deleted them from the line that I added to [Removed Associations] group. For instance, I found this line in mimeapps.cache, “application/xml=wine-extension-xml.desktop;google-chrome.desktop;” but what I copied was just “application/xml=wine-extension-xml.desktop;” because I still want chrome to open xml files.


You may search for:

karl@erlangen:~> find -name '*.list'
erlangen:~ # find / -xdev -name '*.list'|xargs grep -l Application
erlangen:~ #