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



On Wed, Oct 15, 2008 at 5:17 PM, David Zeuthen <david fubar dk> wrote:
> On Wed, 2008-10-15 at 16:48 -0500, Xavier Toth wrote:
>> I'm trying to figure out how to configure "Open With" for a file type
>> during the post install phase of a package that is installing the
>> script which is used to open the file type. Is there an API to do this
>> hopefully with python bindings in nautilus-python?
>
> It's not entirely clear to me what you are asking.
>
> If you are asking how to associate a MIME type with an application, you
> should use the MimeType key in the desktop file for the application.
> Then your application will automagically show up in the "Open With"
> menus etc. in Nautilus. See
>
> http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys
>
> Of course you may need to create a desktop file for this to work. You
> will also need to run update-desktop-database in the RPM %post (or
> similar if not using RPM), see the packaging guidelines for the platform
> you are targeting.
>
> Hope this helps.
>
>     David
>
>
>

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? 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?

Thanks,
Ted


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