Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been struggling this morning trying to associate an application with a custom protocol, namely emacsclient and org-protocol.

I'm calling this protocol from a webbrowser bookmarklet, and I get the following behaviour :

In chromium,
the "Launch Application" dialog comes up, and calls xdg-open org-protocol://... which ends up firing a new chromium frame.

In firefox,
I've tried setting network.protocol-handler.app.org-protocol to an empty string or my emacsclient path, anyhow I get the following error message :
"Firefox doesn't know how to open this address, because the protocol (org-protocol) isn't associated with any program" without even showing any external application selection dialog.

I'm not using any desktop environment, so I need to make this work strictly with xdg, however, despite reading the shared mime info spec etc, I still can't fathom a working configuration.

share|improve this question
add comment

2 Answers

The XDG method: Create an emacsclient.desktop file that handles the x-scheme-handler/org-protocol MIME type:

[Desktop Entry]
Name=Emacs Client
Exec=emacsclient %u
Icon=emacs-icon
Type=Application
Terminal=false
MimeType=x-scheme-handler/org-protocol;

(Note the MimeType= line above, which is for org-protocol: URIs.)

Put the file in ~/.local/share/applications or /usr/local/share/applications.

You might have to open the file ~/.local/share/applications/mimeapps.list and add a line like this:

x-scheme-handler/org-protocol=emacsclient.desktop

Add that under the [Default Applications] section.

share|improve this answer
    
it still opens a chrome window for me; anything else? (i happen to be using fluxbox w/out desktop env similar to orig. author) –  assem May 10 '13 at 1:48
add comment

At least in Fedora 13 and various Debian-based distros xdg-open opens all URLs that don't have a file:// scheme in a browser if it doesn't run in a supported desktop environment. The way it tries to detect which browser to use depends on the distribution.

As xdg-open is just a shell script you can easily adapt it to your needs.

share|improve this answer
    
Indeed, but it is the configuration that is needed between xdg-open and xdg-mime which is very opaque to me, despite reading the docs... –  julien Jul 12 '10 at 21:32
    
If opening a file:// URI Ubuntu doesn't call xdg-mime at all but uses run-mailcap if not running under a supported DE, Fedora 13 first tries to find the default app using xdg-mime and if that doesn't work falls back to mimeopen. xdg-mime uses the Shared MIME Info database freedesktop.org/wiki/Software/shared-mime-info –  Florian Diesch Jul 12 '10 at 23:27
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.