Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ended up source diving. I wrote and stepped into a simple Eclipse Application that only gets the default browser the way Eclipse (the IDE) itself does (<a href="http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/SystemBrowserInstance.java?view=markup#l31" rel="nofollow">in org.eclipse.ui.internal.browser.SystemBrowserInstance</a>):</p> <pre><code>Program.findProgram("html") </code></pre> <p>Turns out Eclipse identifies my "desktop" as <a href="http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt/Eclipse%20SWT%20Program/gtk/org/eclipse/swt/program/Program.java?view=markup#l59" rel="nofollow">DESKTOP_GIO</a>, because I have the <a href="http://developer.gnome.org/gio/2.29/" rel="nofollow">GIO library</a> installed as part of some GNOME dependency. Because it ID's me as such it calls this libgio function:</p> <pre><code>g_app_info_get_default_for_type("text/html", false) </code></pre> <p><a href="http://developer.gnome.org/gio/2.29/ch03.html" rel="nofollow">According to the docs</a>, GIO applications use the X Desktop Group (XDG) "standard" <a href="http://freedesktop.org/Standards/shared-mime-info-spec" rel="nofollow">Shared MIME-info Database</a> to find applications that support a given MIME type.</p> <p>In my case, I've never registered any application as the default handler for text/html, but Eclipse simply chooses the first one returned (which happens to be <code>winebrowser</code>, since it has a <code>wine-extension-html.desktop</code> entry in my <code>~/.local/share/applications/</code> directory).</p> <p>In the end I used:</p> <pre><code>desktop-file-install \ --rebuild-mime-info-cache \ --dir ~/.local/share/applications \ custom-script.desktop </code></pre> <p>to add a desktop entry for my custom script, and:</p> <pre><code>xdg-mime default custom-script.desktop text/html </code></pre> <p>to set it as the default for "html" files.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload