Oracle® Solaris 11.2 Desktop Administrator's Guide

Exit Print View

Updated: July 2014
 
 

How to Register Applications for MIME Types

  1. Create a .desktop file for the application in the $XDG_DATA_HOME/applications or $XDG_DATA_DIRS/applications directory.

    The .desktop file must include a MimeType key whose value comprises each MIME type to be registered, separated by semicolons. For example: MimeType=text/html;text/css;text/x-javascript


    Note - The MimeType key should only be used in the .desktop files whose Type key has Application as the value. For more information about .desktop files, see Working With Desktop Entry Files.
  2. Update the application database.
    # update-desktop-database

    This command creates or updates the mimeinfo.cache file in the same directory as the .desktop file. This cache file is used to facilitate MIME type searches.

  3. Create or update the defaults.list file in the same directory as the .desktop file.

    The defaults.list file is a plain text file that specifies the default application to use for specific MIME types. Each line in the file consists of the MIME type, the = symbol and the Desktop File ID, which is the filename for the desktop entry file. For more information, see Example 6–3.


    Note - Registering MIME types for applications is part of the XDG desktop entry specification rather than the shared mime info specification. For more information, see http://www.freedesktop.org/wiki/Standards/desktop-entry-spechttp://www.freedesktop.org/wiki/Standards/desktop-entry-spec.
Example 6-3  A User's defaults.list File
[Default Applications]
application/pdf=evince.desktop
text/html=epiphany.desktop
text/plain=gedit.desktop
image/jpeg=eog.desktop
image/png=eog.desktop
text/xml=gedit.desktop