Extensions de fichiers sous GNOME
Révision datée du 11 avril 2008 à 17:57 par imported>SylvainBeucler (Nouvelle page : (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 <code>.eml</code> with a locally installed Thunder...)
(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
ex:
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"/> </mime-type> </mime-info>
- 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".
~/.local/share/applications/*.desktop ~/.local/share/applications/mimeinfo.cache
- You can create a site-wide .desktop with 'NoDisplay=true' so it doesn't show in the Applications menu
/usr/local/share/applications/*.desktop /usr/local/share/applications/mimeinfo.cache
or
/usr/share/applications/*.desktop /usr/share/applications/mimeinfo.cache
Then update the cache with:
update-desktop-database
More: create a 'file'-like file detection. Currently the added MIME type conflicts with 'plain text'.
Files
/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:
~/.local/share/applications/defaults.list [Gnome hard-coded priorities, e.g. abiword.desktop - ugh >p] /usr/local/share/applications/defaults.list /usr/share/applications/defaults.list
Sample defaults.list:
[Default Applications] application/msword=openoffice.org2.4-writer.desktop
Icons:
/usr/share/icons/*/*/mimetypes ex: /usr/share/icons/hicolor/48x48/mimetypes/openofficeorg23-text.png
TODO
- /usr/share/application-registry/*.applications
(for priority/precedence?)
- Do we need to use these:
/usr/share/mime-info/*.mime /usr/share/mime-info/*.keys
Avoid Abiword hard-coded high priorioty
dpkg-divert --rename \ --divert /usr/share/applications/abiword-nothardcoded.desktop\ /usr/share/applications/abiword.desktop update-desktop-database
Links
- http://docs.sun.com/app/docs/doc/806-6878/6jfpqt2tp?a=view
- /usr/share/gnome/application-registry
- /usr/share/application-registry/ (Debian)
- http://ubuntuforums.org/showthread.php?t=726230
- update-desktop-database (man -> undocumented)
- /usr/share/applications/mimeinfo.cache
- http://forum.ubuntu-fr.org/viewtopic.php?id=160531
- update-mime-database /usr/share/mime/
- Gnome/KDE file associations
- /usr/share/applications/defaults.list
- Local overrides
- /usr/share/applications/defaults.list
- (?) /etc/gnome/defaults.list
- ~/.local/share/applications/defaults.list