Re: How can I create a filetype association that uses the filename's extension?
- From: Shaun McCance <shaunm gnome org>
- To: Sietse Brouwer <sbbrouwer gmail com>
- Cc: gnome-list gnome org
- Subject: Re: How can I create a filetype association that uses the filename's extension?
- Date: Fri, 07 Jan 2011 11:53:49 -0500
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]