Extensions de fichiers sous GNOME

De Cliss XXI
Révision datée du 8 mai 2008 à 00:22 par imported>SylvainBeucler
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Sauter à la navigation Sauter à la recherche

(Tested with GNOME 2.14)

2 steps:

  • Map your extension with a MIME type
  • Map this MIME type to an application

The goal is to map .eml with a locally installed Thunderbird (~/software/thunderbird/thunderbird).

Map your extension with a MIME type

  • (needed?) Declare the MIME type in /etc/mime.types


application/local.mozilla.thunderbird		eml
  • Declare the MIME type in /usr/share/mime/packages/

ex: /usr/share/mime/packages/thunderbird.xml :

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
	<mime-type type="application/local.mozilla.thunderbird">
		<comment>Saved mail</comment>
		<comment xml:lang="fr">Courriel enregistré</comment>
		<glob pattern="*.eml"/>
  • Refresh the mime cache:
update-mime-cache /usr/share/mime/

Map your MIME type to an application

  • You can right-click on a file with your extension, and select "Open with".
  • You can create a site-wide .desktop with 'NoDisplay=true' so it doesn't show in the Applications menu



Then update the cache with:


More: create a 'file'-like file detection. Currently the added MIME type conflicts with 'plain text'.


/etc/mime.types                           # MIME declaration
/usr/share/mime/packages/*.xml            # glob
/usr/share/mime/application/*.xml         # cache?
/usr/share/mime/mime.cache                # cache
/usr/share/mime-info/*.mime               # ?
/usr/share/mime-info/*.keys               # ?
/usr/share/application-registry/*.applications # priority?
/usr/share/applications/*.desktop         # menu entry and App->MIMEs association
/usr/share/applications/mimeinfo.cache    # MIME->Apps association cache
/usr/share/applications/defaults.list     # priority override
/usr/local/share/applications/ # alternate hierarchy
~/.local/share/applications/   # alternate hierarchy

Priority precedence:

[Gnome hard-coded priorities, e.g. abiword.desktop - ugh >p]

Sample defaults.list:

[Default Applications]




  • /usr/share/application-registry/*.applications

(for priority/precedence?)

  • Do we need to use these:

Avoid Abiword hard-coded high priorioty

dpkg-divert --rename \
 --divert /usr/share/applications/abiword-nothardcoded.desktop\


  • Local overrides
    • /usr/share/applications/defaults.list
    • (?) /etc/gnome/defaults.list
    • ~/.local/share/applications/defaults.list