Re: how can I configure 'Open With' in a script or app



On Thu, 2008-10-16 at 08:49 -0500, Xavier Toth wrote:
> I'll give a specific example of what I'm trying to do. Any time
> someone tries to open an openoffice writer document (.doc, Type: Word
> document, MIME type: application/msword) I want nautilus to run an
> openoffice wrapper script I've supplied that is I want my script to
> show up as the first thing on the menu when I right click on a file of
> this type. I see that desktop files can supply this mapping but how is
> the default determined? 

I initially thought this was what you asked for. Typically OS vendors
use the /usr/share/applications/defaults.list file for this (and it's
overridden by ~/.local/share/applications/defaults.list for users).

You should however be aware that it's considered very bad form for an
ISV to override the default app for a given MIME type. Just because you,
as an ISV, supply an application that happens to be installed, what
makes you think that you should decide what is default?  Also, suggest
to look at Microsoft Windows and all the media players who constantly
battle for being the default. It's ridiculous, you see applications with
things like this

 [X] Always make XYZ the default media player

being turned on by default, and then it's confusion-city for the users.
So please don't do this.

If you control the OS (as a vendor or a site deploing an OS), it's very
simple: just modify /usr/share/applications/defaults.list yourself.

> If I don't want my wrapper script to show up
> on a desktop menu is there another mechanism for establishing the
> default mapping between Type/MimeType and executable?

I think that's what NoDisplay=True does.

Hope this helps.

     David




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