On Wed, 05 Oct 2005 at 08:27AM -0500, Dan wrote:
> I'm a math grad student, so it's unsurprising that my Gnome desktop
> contains a bunch of Mathematica files (which end in .nb). I'd like to
> have Gnome open up Mathematica when I double-click on a .nb file, but
> Gnome thinks these are text files -- which they are, in the same sense
> that an .html file is a text file.

Why does posting to the list help you solve a problem yourself? :)

To associate a file extension with a mime type, follow the instructions
here: http://www.freebsd.org/gnome/docs/faq2.html#q22

The only problem is that when they write

  <xml version="1.0" encoding="UTF-8"?>

the update-mime-database program complains, so you just add a question
mark:

  <?xml version="1.0" encoding="UTF-8"?>

I have no idea why this works, it just does.

The exact files I used are as follows. Here's mathematica.xml in
~/.local/share/applications:

  <?xml version="1.0" encoding="UTF-8"?>
  <mime-type
  xmlns="http://www.freedesktop.org/standards/shared-mime-info"
  type="application/mathematica">
  <comment>Mathematica notebook</comment>
  </mime-type>

Note that application/mathematica is a registered mime type. Otherwise I
think you fake it with application/x-whatever. And here's nb.xml in
~/.local/share/mime/packages:

  <?xml version="1.0" encoding="UTF-8"?>
  <mime-info
  xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/mathematica">
  <comment>Mathematica notebook</comment>
  <glob pattern="*.nb" />
  </mime-type>
  </mime-info>

Then I ran update-mime-database as the article says, logged out and in
-- and everything works. I associated Mathematica to the file type and
everything works perfectly.

Thanks for all your, um, help!

Dan

-- 
Ceci n'est pas une .signature.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20051005/6bc81d8a/attachment.pgp