XFCE - Remove LibreOffice from Default Applications

Is there a way to remove LibreOffice from opening dozens if not hundreds of files listed in Default Applications? I don’t want to uninstall LibreOffice, just not have it automatically open a variety of file formats. Default Applications wants me to disable it one at a time.

Well, default applications are per MIME-type. How should bulk replacement be implemented?

You could edit ~/.config/mimeapps.list and replace libreoffice applications with something else (copy /usr/share/applications/xfce-mimeapps.list into ~/.config/mimeapps.list if it does not exist).

Thank you. I’ll try that.

The “official” way to remove existing application from default list is to add [noparse][Removed Associations][/noparse] section to the ~/.config/mimeapps.list where you list MIME types and your program to be removed. This is basically what your desktop GUI does. Each MIME type still must be listed separately, there is no way to say “blacklist libreoffice.desktop”. May be it should be supported.

https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.1.html

Alternative is to copy application desktop file under ~/.local/share/applications and change it to remove supported MIME types. Like

cat /usr/share/applications/libreoffice-writer.desktop
[Desktop Entry]
Version=1.0
Terminal=false
Icon=libreoffice-writer
Type=Application
Categories=Office;WordProcessor;
Exec=libreoffice --writer %U
**MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oasis.opendocument.text-master;application/vnd.oasis.opendocument.text-master-template;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.template;application/vnd.sun.xml.writer.global;application/msword;application/vnd.ms-word;application/x-doc;application/x-hwp;application/rtf;text/rtf;application/vnd.wordperfect;application/wordperfect;application/vnd.lotus-wordpro;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-word.document.macroEnabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.template.macroEnabled.12;application/vnd.ms-works;application/vnd.stardivision.writer-global;application/x-extension-txt;application/x-t602;text/plain;application/vnd.oasis.opendocument.text-flat-xml;application/x-fictionbook+xml;application/macwriteii;application/x-aportisdoc;application/prs.plucker;application/vnd.palm;application/clarisworks;application/x-sony-bbeb;application/x-abiword;application/x-iwork-pages-sffpages;application/x-mswrite;application/x-starwriter;**
...

Now edit MimeType and remove unwanted ones.

I am not sure which approach is more simple. The mimeapps.list does not replace package .desktop definitions, so is more resilient on update.

In my case if I don’t like an application in your case libreoffice to open a certain file, I just right click the file
and choose open with other application and click the tab to make it the default application to open that file in the future.