Re: How can I create a filetype association that uses the filename's extension?



> Ah. I don't think Nautilus has a GUI for this.

Mmm. Given how traditional it is to use extensions as clues to the
file type (a 'soft' indication on Linux, a 'hard' indication on
Windows), I do think the Open With box should recognise that the
extension may be important, even if it's unregistered. Offer three
options, say:

* Just this once
* Remember for all plain text files called *.extension
* Remember for all plain text files

I've just filed a bug to that extent: 639170. --- And promptly marked
it a duplicate of 596382.
https://bugzilla.gnome.org/show_bug.cgi?id=639170
(The other guy wrote "suffix", and I searched for "extension", hence
why I didn't spot it 'till after I reported it.)

> You can do it manually though, using the XDG
> MIME types system. If you like reading specifications:

I find them tolerable. ;-) Thanks for the links, certainly; I'm sure
I'll work it out from there.

Cheers,

Sietse


On Fri, Jan 7, 2011 at 17:53, Shaun McCance <shaunm gnome org> wrote:
> On Wed, 2011-01-05 at 01:49 +0100, Sietse Brouwer wrote:
>> So, the problem is "no obvious way to 'register a new/unknown
>> extension'," rather than the "extension ignored when determining
>> filetype" I initially reported. Sorry about that. Which would be a
>> problem with the Nautilus 'Open With' dialog rather than a problem
>> with Gnome itself, in which case I'd better head over to the Nautilus
>> mailing list. Does that sound right to you?
>
> Ah. I don't think Nautilus has a GUI for this. You can do it
> manually though, using the XDG MIME types system. If you like
> reading specifications:
>
> http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec
>
> If you'd rather have the quick-and-easy version:
>
> Create the folder .local/share/mime/packages in your home
> folder.
>
> Create a file in that folder with a .xml extension. Call it
> "mymimetypes.xml" or whatever you like. Here's one I just made
> to register a MIME type for Mallard page files:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <mime-info
>  xmlns="http://www.freedesktop.org/standards/shared-mime-info";>
>  <mime-type type="text/x-mallard-page+xml">
>    <comment>Mallard Page File</comment>
>    <glob pattern="*.page"/>
>  </mime-type>
> </mime-info>
>
> Change the type attribute to the MIME type you want. Change the
> comment to whatever you want to see files of that type called
> in Nautilus. Change the glob pattern to match the extension of
> the files. You can have multiple glob elements for each MIME
> type to use that type for any of the globs. You can add more
> mime-type elements to mime-info to register more types.
>
> Save the file, and run the following at the command line:
>
>  update-mime-database  ~/.local/share/mime
>
> Nautilus should pick up the changes immediately.
>
> --
> Shaun


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]