如何使用 .desktop 文件(在 Linux 下)将文件扩展名与应用程序关联起来?
我有一个 .desktop 文件,它将我的应用程序 (mmxfer) 与特定的 mime 类型相关联,并且效果很好。当我右键单击媒体文件时,我可以选择使用 mmxfer 打开它。
但是,如果我想将一个项目与特定的文件扩展名(例如“.sply”)相关联,该文件扩展名实际上只包含一些从 python 序列化的数据,因此没有唯一的 mime 类型,该怎么办?
我当前的 .desktop 文件如下。我应该更改什么才能将 mmxfer 与“.sply”文件关联?
[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 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我希望这篇上一篇文章对您有所帮助。另请查看 XDG 的 共享 MIME信息数据库。
I hope this previous post is helpful. Also take a look at XDG's Shared MIME info database.
您需要先创建 MIME 类型。
You need to create a MIME type first.