如何使用.desktop文件(在Linux下)将文件扩展名与应用程序相关联? [英] How do I associate a file extension with an application using a .desktop file (under linux)?
问题描述
我有一个.desktop文件,该文件将我的应用程序(mmxfer)与特定的mime类型相关联,并且工作正常.当我右键单击媒体文件时,它使我可以选择使用mmxfer打开它.
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.
但是,如果我想将项目与特定的文件扩展名相关联,例如".sply",它实际上仅包含一些从python序列化的数据,因此没有唯一的mime类型,该怎么办?
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?
我当前的.desktop文件在下面.我应该怎么做才能将mmxfer与'.sply'文件关联?
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.
谢谢!
推荐答案
您需要创建MIME类型首先.
这篇关于如何使用.desktop文件(在Linux下)将文件扩展名与应用程序相关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!