Skip Navigation Links | |
Exit Print View | |
Oracle Solaris 11.1 Desktop Administrator's Guide Oracle Solaris 11.1 Information Library |
1. Administering the Oracle Solaris Desktop
2. Managing User Preferences With GConf
Understanding MIME Type XML Files
Registering Applications for MIME Types
How to Register Applications for MIME Types
How to Associate a MIME Type With an Application
9. Overview of the Yelp Help Browser
10. Improving the Performance of the Oracle Solaris Desktop System
11. Disabling Features in the Oracle Solaris Desktop System
You should never directly modify the source XML files that are installed by applications in the <MIME>/packages directory. Instead, modify the Overrides.xml file. This file has precedence over all other source XML files installed into the same packages directory. If you are an application author, then this rule does not apply. Application authors should create a new source XML file and place the file in the <MIME>/packages directory.
You can modify the MIME database for all users on the system or for a particular user depending on the location of the file you change. To modify the database for all users, make changes to the file Overrides.xml in the $XDG_DATA_DIRS/mime/packages directory. To modify the database for a single user, make changes to the Overrides.xml file in the $XDG_DATA_HOME/mime/packages directory.
After changes are made, you must always run the update-mime-database application with the directory location of the MIME database as the first parameter.
If the file already exists, open it.
# update-mime-database /usr/share/mime
# update-mime-database ~/.local/share/mime/packages
# update-mime-database /usr/share/mime
For example, the gnomevfs-info command displays the following output when you run the command for a SVG file. Note that the default application for this MIME type is eog.desktop.
$ gnomevfs-info mime-diagram.svg Name : mime-diagram.svg Type : Regular MIME type : image/svg+xml Default app : eog.desktop Size : 14869 Blocks : 32 I/O block size : 4096 Local : YES SUID : NO SGID : NO Sticky : NO Permissions : 600644 Link count : 1 UID : 1000 GID : 100 Access time : Wed Feb 22 18:24:47 2006 Modification time : Wed Feb 22 18:24:42 2006 Change time : Wed Feb 22 18:24:42 2006 Device # : 775 Inode # : 297252 Readable : YES Writable : YES Executable : NO $
For more information about default applications, see Registering Applications for MIME Types.
Example 6-2 Creating an application/x-newtype MIME Type
Create a new file, test.xyz, in your home directory.
Use the gnomevfs-info command to find the file's MIME type.
$ gnomevfs-info text.xyz
The MIME type for this file should be detected as text/plain because no glob patterns or magic rules match the file.
Note - When no glob patterns or magic rules match a file, then the file is resolved to the text/plain MIME type if the file contains textual data or application/octet-stream for binary data. If the file is empty, then the type is identified as text/plain MIME type.
Create the Overrides.xml file or if the file already exists, modify the file.
The sample XML file is as follows:
<?xml version='1.0' encoding='utf-8'?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="application/x-newtype"> <comment>new mime type</comment> <glob pattern="*.xyz"/> </mime-type> </mime-info>
Update the MIME database by using the update-mime-database command.
# update-mime-database /usr/share/mime
Use the gnomevfs-info command to verify that your change has taken effect.
$gnomevfs-info testing.xyz | grep MIME MIME type : application/x-newtype
You should see that the MIME type for the testing.xyz file is resolved as application/x-newtype.