Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I associate a file extension with an application using a .desktop file (under linux)?

Tags:

linux

desktop

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!

like image 562
DaedalusFall Avatar asked Oct 20 '25 14:10

DaedalusFall


2 Answers

You need to create a MIME type first.

like image 165
Ignacio Vazquez-Abrams Avatar answered Oct 22 '25 02:10

Ignacio Vazquez-Abrams


I hope this previous post is helpful. Also take a look at XDG's Shared MIME info database.

like image 21
Wesley Rice Avatar answered Oct 22 '25 02:10

Wesley Rice