问题
I have a .desktop file which associates my application (mmxfer) with specific mime types, and this works fine. When I right click a media file it gives me the option to use mmxfer to open it.
But what if I want to associate a project with a specific file extension, say '.sply', which really just contains some data serialized from python and so doesn't have a unique mime-type?
My current .desktop file is below. What should I change to associate mmxfer with '.sply' files?
[Desktop Entry]
Name=MMXfer
Comment=Convert music and video and transfer it to a portable player using mtp
Exec=/usr/local/bin/mmxfer %U
Icon=/usr/local/share/mmxfer/mmxfer.png
Terminal=0
Type=Application
Categories=Application;AudioVideo;
MimeType=application/ogg;
I missed out most of the mime types as there were dozens.
Thanks!
回答1:
You need to create a MIME type first.
回答2:
I hope this previous post is helpful. Also take a look at XDG's Shared MIME info database.
来源:https://stackoverflow.com/questions/4218655/how-do-i-associate-a-file-extension-with-an-application-using-a-desktop-file-u