0

I am trying to create file associations so I can double click a file and it will open with my program - and will associate an icon with that file type.

I created the file myapp-xxx.xml:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    <mime-type type="application/myapp-xxx">
        <comment>My app dummy mime</comment>
        <sub-class-of type="application/octet-stream"/>
        <glob pattern="*.xxx"/>
        <generic-icon name="MyApp"/>
    </mime-type>    
</mime-info>

I placed MyApp.png in /usr/share/icons/

I placed myapp-xxx.xml in /usr/share/mime/application/

I ran

sudo update-mime-database /usr/share/mime

and my xml promptly disappeared.

I read that it can be because i am missing description... but looking at all the examples, and the existing mimes, I don't see what I am missing.

12.04

Note: I have a .desktop file too... but since the mime database removes the mime, I don't think having the reference in the .desktop file will help.

6
  • Welcome to askubuntu! .xxx is not a valid mime type you will likely have better luck using a valid type. A rather exhaustive list can be found here: sitepoint.com/web-foundations/mime-types-complete-list
    – Elder Geek
    Oct 30, 2014 at 19:46
  • You may find this Q&A on superuser.com to be helpful: superuser.com/questions/649928/…
    – Elder Geek
    Oct 30, 2014 at 19:49
  • I made xxx up - trying to make a custom mime type - using the file extension of the files saved . If I use an existing mime type, I may as well just use application/octet-stream right ? Just read the link above - so i must place my mime description in the packages not application - and have to name it after my application, without the little extra I added ? what if an application installs multiple mime types ?
    – Thalia
    Oct 30, 2014 at 19:54
  • Hopefully the Q&A on superuser.com will more helpful in allowing you to achieve your intendeed result.
    – Elder Geek
    Oct 30, 2014 at 20:01
  • I moved the xml file in packages and it didn't get deleted anymore. Running mimetype -a myfile.xxx showed both mime types.
    – Thalia
    Oct 30, 2014 at 20:02

1 Answer 1

0

I placed the file myapp-xxx.xml in /usr/share/mime/packages/ (instead of /usr/share/mime/application/)

Running sudo update-mime-database /usr/share/mime did not remove my xml file...

Running mimetype -a Desktop/abcd.xxx showed

Desktop/abcd.xxx: application/myapp-xxx
Desktop/abcd.xxx: application/octet-stream

Thank you Elder Geek for the resource.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .