[SOLVED] Eliminating aggressive mime-types that are inserted in everything?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
ineuw
Level 5
Level 5
Posts: 825
Joined: Sun Nov 13, 2016 12:27 am
Location: Montreal, Canada

[SOLVED] Eliminating aggressive mime-types that are inserted in everything?

Post by ineuw »

How can I eliminate mime types that keep appearing on the open with list? How can I dissociate them from where they don't belong? I am referring to LibreOffice being #1 offender, closely followed by Vivaldi as #2, and poor Firefox as #3.
Last edited by LockBot on Mon Jun 05, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Desktop: Linux Mint Cinnamon 21.3 English Edge - Desktop: Linux Mint Cinnamon 21.3 French
Laptop: Linux Mint Cinnamon 21.3 English - as of 24-04-15
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: Eliminating aggressive mime-types that are inserted in everything?

Post by Termy »

If they keep appearing and it's down to the same programs, I would imagine it's those programs automatically doing it. Have a deep-dive into LibreOffice settings to see if there's an option causing this.

That being said, it seem pretty awkward to change MIME types in Linux. We need a solid graphical interface for managing all MIME types in an easy way, precisely for distributions like Linux Mint. A command-line approach, which isn't too bad, but not very user-friendly, is to edit '/etc/mime.types' and perhaps use something like '/usr/share/mime' for reference. If you go that approach, I'd be cautious and especially back up the original file in-case you make a mistake. According to '/etc/mime.types', a user can even have their own MIME types specified in '~/.mime.types', with presumably the same format; that should be safer than editing the global file.
I'm also Terminalforlife on GitHub.
User avatar
ineuw
Level 5
Level 5
Posts: 825
Joined: Sun Nov 13, 2016 12:27 am
Location: Montreal, Canada

Re: Eliminating aggressive mime-types that are inserted in everything?

Post by ineuw »

Termy wrote: Mon Dec 05, 2022 7:11 am If they keep appearing and it's down to the same programs, I would imagine it's those programs automatically doing it. Have a deep-dive into LibreOffice settings to see if there's an option causing this.
I only vaguely know the elements involved, and I don't know the process flow. Where does an app register their mime types initially? When (and how) the
mimeapps.list updated? How can a user bypass these replacements?

Being a single user on this desktop, I tried effecting changes on the system level. But now, I am considering to keep all changes in $HOME, and hope that system changes won't affect my preferences. https://wiki.archlinux.org/title/XDG_MIME_Applications. Perhaps this link on archlinux lists some recent changes for users ~/.config/mimeapps.list.
Desktop: Linux Mint Cinnamon 21.3 English Edge - Desktop: Linux Mint Cinnamon 21.3 French
Laptop: Linux Mint Cinnamon 21.3 English - as of 24-04-15
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: Eliminating aggressive mime-types that are inserted in everything?

Post by Termy »

ineuw wrote: Mon Dec 05, 2022 7:51 am [...]
Because I haven't looked heavily into MIME types in traditional desktop environments, I can only make an educated guess that it's done during individual software installation, such as with the Debian package. Perhaps the package is instructed to edit the '/etc/mime.types' file.

You'll probably want to do some research into all of this. When it comes to topics like this (more advanced and obscure), you often need to go down the rabbit hole yourself. Were this a Gentoo or Arch Linux board, it'd probably be a different story, but given the target audience of Linux Mint, typically people just want to get on with using their system, without picking it apart. That's not a dig, BTW — I spent years picking apart my system, and was certainly rewarded for it, but it's not for everyone.
I'm also Terminalforlife on GitHub.
Matera
Level 1
Level 1
Posts: 20
Joined: Wed Jun 24, 2015 11:21 am

Re: Eliminating aggressive mime-types that are inserted in everything?

Post by Matera »

I've had good results editing local files. I haven't messed with the global configs. My problem most frequently involves mime types vs. extensions. CherryTree Notes uses XML, SQLite, and 7Zip for its several storage types, but uses its own extensions, so things get messed up easily. Double-click a file and godnose what will open it. CherryTree is handed XML and 7z files, while CherryTree files are picked up by a hex editor or something.

In /.config/mimeapps.list I found a couple of instances of application/x-extension-[ct*]=cherrytree.desktop,but there were also a few association horrors. There should be a GUI way to do this, particularly for new users and the less adventurous (or more time-restricted). In Windows everything is handled by extension, so people are usually unaware of what's going on. And there is - or was, lol, I haven't been there much lately - a useful dialog for fixing things if one needs to.

Back in the old Win days, I used to create an occasional file type, like .yxy, which is a typo for .txt that often happened to me, so I wouldn't have to rename every time. It doesn't matter now. I've also seen text files with "extensions" that were more of an extension of the filename (e.g. "basil.herb, sage.herb"), apparently quite handy for sorting. In this case it's a good thing when extension isn't related to mime type. Unfortunately, there are complications like files of different mime types having the same extension. I usually just add something to the Open With list for them.

Caja scripts are good for creating universal open-with commands like, no matter what it is, open with the hex editor, or favorite text editor.
When I have a computer problem, I call myself.
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: Eliminating aggressive mime-types that are inserted in everything?

Post by Termy »

Matera wrote: Mon Dec 05, 2022 2:54 pm In Windows everything is handled by extension, so people are usually unaware of what's going on.
Just to throw a spanner into the works: there's a thing called a magic number (AKA: file signature), which is a special string stored in a file, essentially hard-coding its type. This is the case everywhere, but not necessarily with all file types. For example, a shell script does not contain a magic number, but is instead determined by things like the extension and the shebang. Yet, a JPEG file will always be a JPEG file, regardless of whether you change the extension in Windows, Mac, Linux, *BSD, etc.

Check out this page for common strings.
I'm also Terminalforlife on GitHub.
User avatar
ineuw
Level 5
Level 5
Posts: 825
Joined: Sun Nov 13, 2016 12:27 am
Location: Montreal, Canada

Re: Eliminating aggressive mime-types that are inserted in everything?

Post by ineuw »

I am curious who uses LibreOffice as a script editor? . . . and Vivaldi or Firefox as the .xml editor?

Would it be possible to direct the system to use my local configurations in the menu.

I am searching for info on how can I override the configurations locally, and the variety of configuration files in the $home and ~/.config folders seem to be defined differently.
Desktop: Linux Mint Cinnamon 21.3 English Edge - Desktop: Linux Mint Cinnamon 21.3 French
Laptop: Linux Mint Cinnamon 21.3 English - as of 24-04-15
User avatar
ineuw
Level 5
Level 5
Posts: 825
Joined: Sun Nov 13, 2016 12:27 am
Location: Montreal, Canada

Re: Eliminating aggressive mime-types that are inserted in everything?

Post by ineuw »

I was successful in eliminating LibreOffice listed as a text editor on the "Open with" context menu.

The answer was in the ArchLinux article about mimes, mentioned previously in this thread. The "text" related mime category is extensive, and its sub-categories are listed in /usr/share/mime/text/plain.xml. LibreOffice asserted itself as the default, or as one of the options, for all text related categories.

The unwanted mime assignments can be disassociated by erasing the words "libreoffice-writer.desktop;" from the mime, in the /usr/share/applications/mimeinfo.cache file. Once this file is saved, execute the commands:

Code: Select all

sudo update-desktop-database -v /usr/share/applications
sudo update-mime-database  -v /usr/share/applications
And this updates the system mime databases.

For additional user preferences, I copied the system "mimeinfo.cache" to /home/ineuw/.local/share/applications, changed the file ownership and executed the commands which recreated the same environment in my personal space for modifications I don't wish to exist systemwide:

Code: Select all

update-desktop-database -v /home/ineuw/.local/share/applications
update-mime-database -v /home/ineuw/.local/share/applications
Strongly recommend to clear the local and system caches and reboot.
Desktop: Linux Mint Cinnamon 21.3 English Edge - Desktop: Linux Mint Cinnamon 21.3 French
Laptop: Linux Mint Cinnamon 21.3 English - as of 24-04-15
Locked

Return to “Software & Applications”