Where are the default applications configured?

Questions about applications and software
Forum rules
Before you post please read how to get help

LMDE 2 support ends on 1-1-2019
Post Reply
Tomas_IV
Level 1
Level 1
Posts: 18
Joined: Tue Jun 02, 2009 11:43 am

Where are the default applications configured?

Post by Tomas_IV » Tue Apr 17, 2018 1:24 pm

Hello, running LMDE2 Mate. I decided to install current Libreoffice Still using Debian packages provided by Libreoffice project. I have removed Libreofice 4, did it on few my computers. On all of them now OpenDocument (like .odt, ods,...) and Office files (.docx, .xlsx...) open in Engrampa and this fails. I can change it format by format in Caja by right-clicking the file, Properties.. etc., and did it this way on work computer I use exclusively, but even so it is quite a lot of work, it is many file types - just for text document there are a document, template, main document, that all in Microsoft and in ODF formats. On my home computer I would need to do it all for four users, so I would rather do it different way and also in a way that when I next time install lets say Libreoffice 6, it will not hapen all over again.

Setting it manually through Caja I also discovered, that Engrampa is now "the default" - I mean when you in the Caja Properties/Open With dialog click the button Default, Engrampa is selected even if Libreoffice was previously set by the user, and it is not possible to remove Engrampa from the options. Also note, that the documents are recognized as documents with right mime type, in Caja and on the desktop they have Libreoffice or MS Office document icons. New Libreoffice5 is present as option to select, is even listed before Engrampa in Caja file Properties, but Engrampa is selected by default.

Because of this is true for all user accounts, I suppose Engrampa is set somewhere system-wide as an app opening documents (which it refuses to anyway, although I know the documents are in fact zip archives of xml files). However, looking into:

Code: Select all

~/.config/mimeapps.list
~/.local/share/applications/mimeapps.list
/etc/linuxmint/adjustments/15-gnome-mimetypes.overwrite
/usr/share/applications/defaults.list
I can not find, where Engrampa is set to handle any document type, so how comes it appears in document opening options and is even a system-wide default (in absence of libreoffice from repsitory)? I suppopse there must be other mimeapps/defaults list I am missing.
Thanks for any hint.

User avatar
Flemur
Level 16
Level 16
Posts: 6184
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Where are the default applications configured?

Post by Flemur » Tue Apr 17, 2018 9:30 pm

Tomas_IV wrote:
Tue Apr 17, 2018 1:24 pm

Code: Select all

~/.config/mimeapps.list
~/.local/share/applications/mimeapps.list
/etc/linuxmint/adjustments/15-gnome-mimetypes.overwrite
/usr/share/applications/defaults.list
I can not find, where Engrampa is set to handle any document type, so how comes it appears in document opening options and is even a system-wide default (in absence of libreoffice from repsitory)? I suppopse there must be other mimeapps/defaults list I am missing.
Thanks for any hint.
As you've discovered, the "freedesktop.org" implementation of "mime" is a convoluted mess with files all over the place (more than you've found!) and a super-complicated way to perform a very simple task: associate program(s) with a file extension.

There's another whole mess in /usr/share/mime/ (that's where the dumb file-browser display names are set)

Anyway, set custom stuff in

Code: Select all

~/.config/mimeapps.list
Each entry looks like:

Code: Select all

audio/mpeg=foobar.desktop;
video/mp4=smplayer.desktop;vlc.desktop;smplayer_enqueue.desktop;foobar.desktop;xplayer.desktop;
Most or many - but not all! - of the entries are in TWO places in that file, once under [Added Associations] and again under[Default Applications]. Some of my custom settings are under one, some under the other, some under both. Go figger.

I think you can copy that .config/mimeapps.list file to each user and they'll be all set.

Edit:

Notice that in the file .config/mimeapps.list there's an extra level of confusion. But of course!

For a .bmp file, the entry is: image/x-win-bitmap=iview.desktop; ; IOW, you have to find the SPECIAL FREEDESKTOP.ORG name for your file extension!

So for a .odc file, you can't just put ".odc" there along with the program name to open it.

So you look in
/usr/share/mime/packages/freedesktop.org.xml
and find that ODC is a
<mime-type type="application/vnd.oasis.opendocument.chart">
and that's the BS you put in .config/mimeapps.list:

Code: Select all

application/vnd.oasis.opendocument.chart=leafpad.desktop
(I wrote that one, didn't copy it, so be careful).

Edit2:
Another fun feature is if you use one program to open more than one file type, it makes a .desktop file for each file type, all with the same content but a different file name, like

Code: Select all

userapp-iview-OAKJHZ.desktop
userapp-iview-VLM6FZ.desktop
Since the content is the same, you can delete all but one and rename it to iview.desktop and fix config/mimeapps.list so it matches the simple, informative name. (you DON'T need to do this though)

The .desktop files are in yet ANOTHER LOCATION!
~/.local/share/applications/iview.desktop, etc.

Edit3: Here are the system files (plus your user files!) that define a(n) ODF file:

Code: Select all

$ pwd
/usr/share/mime
$ grep -iRl ODF *
application/vnd.oasis.opendocument.formula.xml
application/vnd.oasis.opendocument.formula-template.xml
globs
globs2
packages/freedesktop.org.xml
Pretty sweet, huh?

Edit4:
I can not find, where Engrampa is set to handle any document type,
Don't feel bad - I can't find where "gimp" is set as the default to open .xcf files (xcf is defined in 8 different files under /usr/share/mime)
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 18.3 Xfce/fluxbox/pulse-less
Xubuntu 17.10/fluxbox/pulse-less

Tomas_IV
Level 1
Level 1
Posts: 18
Joined: Tue Jun 02, 2009 11:43 am

Re: Where are the default applications configured?

Post by Tomas_IV » Wed Apr 18, 2018 2:40 am

Thank you, when at home, I will look into it and let you know if I found something.

Post Reply

Return to “Software & Applications”