Associate a file extension with an application

Mathias Brodala info at noctus.net
Sat Mar 24 23:55:40 CET 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

Joe Riel, 24.03.2012 06:44:
> On Sat, 24 Mar 2012 03:18:45 +0100 Mathias Brodala
> <info at noctus.net> wrote: Joe Riel, 23.03.2012 01:45:
>>>> In my case, I'd like to double-click on a Maple worksheet 
>>>> (extension .mw) and have it be opened with the Maple
>>>> application. However, a .mw file uses xml formatting, so if I
>>>> click File -> Properties in Thunar and then try to change the
>>>> application to Maple, it wants to associate *all* xml files
>>>> with Maple.  That is not what I want.
> 
> You can follow the examples from the xdg-mime[1] tool. Save the 
> following as mapleprimes-maple.xml:
> 
> <?xml version="1.0"?> <mime-info
> xmlns='http://www.freedesktop.org/standards/shared-mime-info'> 
> <mime-type type="application/maple"> <comment>Maple
> worksheet</comment> <glob pattern="*.mw"/> </mime-type> 
> </mime-info>
> 
> Now run the following command:
> 
> xdg-mime install mapleprimes-maple.xml
> 
> Now *.mw files are assigned a custom MIME type (application/maple
> here according to [2]) and can be assigned a custom default
> application.
> 
>> Thanks.  After installing the mime it didn't quite work:
> 
>> $ XDG_UTILS_DEBUG_LEVEL=1 xdg-mime query filetype
>> ../Downloads/plot3drotate.mw Running file -i
>> "/home/joe/Downloads/plot3drotate.mw" application/xml;
>> charset=us-ascii

I almost get the same here, only --mime-type instead of -i is used here.

>> The diagnostic message indicates xdg-mime is using file to 
>> determine the file type.  That won't work.  A bit of web 
>> searching indicates I need to install libfile-mimeinfo-perl. That
>> did the trick.

I don’t have that package installed and MIME type assignment as
described above works in Thunar nevertheless. The CLI output might
differ, but I don’t care about that one.


Regards, Mathias
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9uUN8ACgkQYfUFJ3ewsJjHaQCggDqq5FC9K1ENXfEzWP/a0pKW
H00An3r4vSP6C/DkCKVB5eDmMR8fAsNr
=q+gg
-----END PGP SIGNATURE-----


More information about the Xfce mailing list