Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new Mime Type and associate with new application?

I have a new file type ".xy2" and I would like to associate it with a custom application "shim". Does anyone know how to do it in a Linux?

Thanks

like image 561
Gene Avatar asked Feb 18 '13 19:02

Gene


People also ask

How do I add a MIME type?

In the Connections pane, go to the site, application, or directory for which you want to add a MIME type. In the Home pane, double-click MIME Types. In the MIME Types pane, click Add... in the Actions pane. In the Add MIME Type dialog box, add the file name extension and MIME type, and then click OK.

How do I change the MIME type of a file in Windows?

Windows makes it very convenient to associate programs and file type Right click the file and open up properties. From here, under the general tab, you can choose which app opens this specific file type. Hit change, and navigate to your shim.


1 Answers

In case someone comes across the same problem. I found the answer:

  1. Create new Mime Type. You can specify a different mime-type, in this video the author is using text, but you can use application or image etc.. All available types are listed in "usr/share/mime" folder.
  2. Create your custom application and put a symlink into "usr/bin" folder.
  3. Navigate to "~.local/share/applicatons" folder and create new_mime_name.desktop file.
  4. Fill in information pertaining to your application. Here is an example of mine:

    [Desktop Entry]
    Terminal=false
    Icon=libreoffice-math
    Type=Application
    Categories=Application;Utility;
    Exec=shim %f
    MimeType=application/xy2;
    Name=shim
    Comment=shim tool
    
  5. Associate file types with your application. Read post from OM55 user.

  6. You might need to reboot your system.
like image 140
Gene Avatar answered Sep 28 '22 07:09

Gene