restore default MIME file type associations [SOLVED]

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
spamhog
Level 3
Level 3
Posts: 146
Joined: Thu Dec 17, 2009 6:21 pm
Contact:

restore default MIME file type associations [SOLVED]

Post by spamhog »

:evil: :evil: :evil: Installed Google Chrome. (*)
It surreptitiously changed most DEFAULT file associations
to open with Chrome without even asking.

Easy to change back manually at user level with a MIME type editor, no root.

This is how to change the defaults file back to original in case something messes it up.

Tested on 20.1 XFCE, should work on other systems.

Defaults are here: /usr/share/applications/defaults.list

My original is gone. My current included these gems:

Code: Select all

user@host:~$ less /usr/share/applications/defaults.list | grep google
application/pdf=xreader.desktop;org.gnome.Evince.desktop;google-chrome.desktop
application/rdf+xml=google-chrome.desktop;
application/rss+xml=google-chrome.desktop;
application/xhtml+xml=google-chrome.desktop;
application/xhtml_xml=google-chrome.desktop;
application/xml=google-chrome.desktop;
image/gif=xviewer.desktop;org.gnome.eog.desktop;google-chrome.desktop
image/jpeg=xviewer.desktop;org.gnome.eog.desktop;google-chrome.desktop
image/png=xviewer.desktop;org.gnome.eog.desktop;google-chrome.desktop
image/webp=google-chrome.desktop;
text/html=firefox.desktop;google-chrome.desktop
text/xml=xed.desktop;org.gnome.gedit.desktop;google-chrome.desktop
x-scheme-handler/ftp=google-chrome.desktop;
x-scheme-handler/http=firefox.desktop;google-chrome.desktop
x-scheme-handler/https=firefox.desktop;google-chrome.desktop
application/rdf+xml=google-chrome.desktop;
application/rss+xml=google-chrome.desktop;
application/xhtml+xml=google-chrome.desktop;
application/rdf+xml=google-chrome.desktop;
application/rss+xml=google-chrome.desktop;
application/xhtml+xml=google-chrome.desktop;
To identify which .deb package any file on a working system comes from:

Code: Select all

user@host:~$ sudo dpkg -S /usr/share/applications/defaults.list
[sudo] password for user:              
desktop-file-utils: /usr/share/applications/defaults.list
... where desktop-file-utils is the package name.

Download that single package (no root, this will trigger a full package list update):

Code: Select all

user@host:~$ apt download desktop-file-utils
Hit:1 http://archive.canonical.com/ubuntu focal InRelease
....
....
....
Get:1 http://ftp.fau.de/mint/packages ulyssa/upstream amd64 desktop-file-utils amd64 0.24+linuxmint1 [53,2 kB]
Fetched 53,2 kB in 10s (5.072 B/s)        
The package desktop-file-utils is already installed. Its deb file was downloaded in the current directory.

This downloads the .deb package in the current directory.

Opening it with archiver and navigating to /usr/share/applications/defaults.list shows A SYMLINK, extracting the file shows it links to /etc/gnome/defaults.list, which missing on my system (XFCE, shouldn't matter), and I assume dereferenced (=copied from the target file in the package) when installed. Second round of searching shows that /etc/gnome/defaults.list is from the same .deb package.

Extracted and renamed to defaults.list-original.

Comparing using meld you can see if the default is decent for you. I can see Chrome DELETED several associations to Firefox, subbed itself to others apps, and added many associations to file types that weren't even there...

Image

I judge the original defaults file it to be reasonable for my use.

To restore the defaults, as root:

Code: Select all

root@host:/usr/share/applications# cp defaults.list defaults.list-borked-by-chrome
root@host:/usr/share/applications# cp /home/user/defaults.list-original ./defaults.list-original-16apr21
root@host:/usr/share/applications# rm defaults.list
root@host:/usr/share/applications# cp defaults.list-original-16apr21 defaults.list
root@host:/usr/share/applications# ls defaults.list*
defaults.list  defaults.list-borked-by-chrome  defaults.list-original-16apr21
Chrome gone from defaults, at least for now. An original dated file is now available next to the current file. I also saved another copy with my collection of manually installed software.

(*) I THOUGHT I needed it for Google Remote Desktop, eventually used less evil TeamViewer.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Locked

Return to “Software & Applications”