Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I can add a new MIME type in shared MIME-info, but how can I associates this MIME type with an application?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

if you just want to associate them directly, and not make them default, you can add them to

/usr/share/applications/mimeinfo.cache

(system-wide), or

~/.local/share/applications/mimeinfo.cache

(per-user).

edit: using xdg-mime, as geekosaur suggests, might perhaps be more robust. In this case, you would want

xdg-mime install [--mode mode] [--novendor] mimetypes-file

Adds the file type descriptions provided in mimetypes-file to the desktop environment. mimetypes-file must be a XML file that follows the freedesktop.org Shared MIME-info Database specification and that has a mime-info element as its document root. For each new file type one or more icons with name major-minor must be installed with the xdg-icon-resource command in the mimetypes context. For example the application/vnd.oasis.opendocument.text filetype requires an icon by the name of application-vnd.oasis.opendocument.text to be installed.

share|improve this answer

Use the xdg-mime command.

xdg-mime default application mimetype

Ask the desktop environment to make application the default application for opening files of type mimetype. An application can be made the default for several file types by specifying multiple mimetype s.

The above is taken from man xdg-mime, slightly modified to copy the usage down from the SYNOPSIS.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.