Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I associate files with same MIME but different extensions to different applications.
For example both .maff & .zip files have application/zip MIME ; But I need to open .maff by Firefox and .zip by ArchiveManager
Setting this via Open with dialog associates application to MIME that causes both files open with same application.
How can I configure this in Gnome?
I'm using Ubuntu Lucid Lynx.

Thanks

share|improve this question

Simple way to do this is by using mimeopen command to open .maff file format using Firefox

Open terminal and type

mimeopen some_file_name.maff

You will be provided with available packages to open the .maff file

Please choose a default application for files of type application/zip

    1) Archive Manager  (file-roller)
    2) Archive Mounter  (mount-archive)
    3) Other...

select 3 from the option and enter the command as firefox

use application #3
use command: firefox

This will open up .maff file in Firefox and will be set as default program to open .maff file

share|improve this answer
    
#1: This only sets default application for mimeopen and not nautilus! #2 this still only relys on mime type so setting default application for .maff will sets that application for .zip too!!! (I tried and it did) – RYN Dec 7 '12 at 22:35

I don't know what a .maff file is exactly, but you need to define a new MIME type for it. Application associations are based on MIME type and not file extension.

share|improve this answer
    
.maff is the "Mozilla Archive Format" that is used by a firefox extension that actually is a zip file like .jar files; How should I define a MIME for that? Thanks – RYN Dec 7 '12 at 21:00

I posted my step-by-step solution here:

http://ubuntuforums.org/showthread.php?p=12505072#2

share|improve this answer

As of 2016/Feb/20, this is the correct solution to associate MAFF files to Firefox (or any other files), without affecting the Compressed archive/ZIP association:

# run as sudo

echo '<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-maff">
<comment>Maff File</comment>
<glob pattern="*.maff"/>
</mime-type>
</mime-info>' > /usr/share/mime/packages/maff.xml

update-mime-database /usr/share/mime

# now kill X or logout.

The assogiate solution is not valid anymore, as the package has been removed from the Ubuntu repositories after v14.04.

share|improve this answer

I've faced similar issue in LinuxMint 17.1 Cinnamon. Perhaps this also will work for Gnome (because both follow freedesktop.org).

I strove to make Firefoxmaff association only for one user (me). So I didn't touch files under /etc.

I did the following:

  1. Restore correct association between ZIP-files and archive manager (I did it within default file manager Nemo).

  2. Create definition of MIME type. In my case I created firefox-maff-my.xml file in ~/.local/share/mime/packages directory with the content provided below:

<?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="application/maff"> <comment>Mozilla Archive Format</comment> <glob pattern="*.maff"/> </mime-type> </mime-info>

  1. Update MIME database

update-mime-database ~/.local/share/mime/

  1. Edit ~/.local/share/applications/mimeapps.list. Add application/maff=firefox.desktop line right under [Default Applications]

  2. Log out, then log in.

In case of doubts you can make backup of each involved file before editing it. If something will go wrong you can revert everything you did (just restore original files, remove firefox-maff-my.xml and run update-mime-database ~/.local/share/mime/ again).

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.