Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have written a simple application which registers an "x-scheme-handler" in the .desktop file. Something like this:-

[Desktop Entry]
Name=Foo
Exec=/usr/bin/foo %u
Type=Application
NoDisplay=true
Categories=System;
MimeType=x-scheme-handler/foo;

This allows a user to click a foo:// link in the browser to launch my app. However firefox pops up a "Launch Application" dialog box to ask the user which application to launch, with mine being the default.

How can I suppress this dialog box so that firefox just launches the application without requiring the popup confirmation.

share|improve this question
    
... I presume you mean to open "automatically"? I note that the software-center is not opened by default when you click apt links - you get the launch application dialog but if you click the little check box at the bottom then it always opens. Which app type does not open the launch application dialog by default? –  fossfreedom Jul 17 '12 at 22:34
add comment

3 Answers

You should consider adding a RDF schema in your ~/.mozilla/firefox/PROFILE/mimeTypes.rdf file, such as:

<RDF:Description RDF:about="urn:scheme:foo"
               NC:value="foo">
               <NC:handlerProp RDF:resource="urn:scheme:handler:foo"/>
</RDF:Description>

Or, if this doesn't work:

<RDF:Description RDF:about="urn:mimetype:handler:foo"
   NC:alwaysAsk="false"
   NC:useSystemDefault="true"
   NC:saveToDisk="false">
   <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:foo"/>
</RDF:Description>
share|improve this answer
    
That could work, but I don't think packages are 'allowed' to monkey with data in home during install are they? So my application wouldn't be able to do this, but perhaps there is a system wide place that could be modified by root? –  popey Jul 13 '12 at 13:35
    
They should, as you're installing/upgrading as sudoer. Anyway, you could consider to add the new mimetype to /etc/mime.types too, and install xul-ext-ubufox package to make Firefox file associations consistent with Ubuntu file associations. –  jasmines Jul 13 '12 at 15:54
add comment

When the Launch Application dialog comes up for the first time, click the box that says "Remember my choice", then click OK.

firefox launch application dialog

share|improve this answer
add comment

Firefox has got a system that recognizes the file extension or browser bar extension. In the Firefox Preferences (Menu -> Edit -> Preferences -> Applications) you can specify what to do when opening which file.

That what you are looking for is an application protocol. With this, you can open a specific file or launch an application.

These scheme-handlers are stored in a the file ~/.mozilla/firefox/YOUR_PROFILE_ID/mimeTypes.rdf. Open the .rdf file with gedit or your favorite text editor.

Now you should see XML text. You can divide the file into a header, the schemes and the footer.

A normal entry looks like this:

<RDF:Description RDF:about="urn:scheme:NAME"
     NC:value="ENTER YOUR VALUE">
    <NC:handlerProp RDF:resource="urn:scheme:handler:NAME"/>
</RDF:Description>

Now you can edit the scheme-handler file and add your own entry. I hope this helps you!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.