Using the Eclipse SDK under Linux, there's an entry in the list of "External web browsers" for "Default system web browser". How is this default determined?
I set up and selected an entry that calls my own version of xdg-open
which is just a wrapper to launch Chromium. But, when I launched a project from the GWT plugin, it defaulted back to "Default system web browser".
I don't use a major desktop environment (neither GNOME nor KDE), so I'm unsure how any default would be set. But it would be nicer to set this globally and avoid per-application (or per-plugin) configuration in the future.
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 ( in org.eclipse.ui.internal.browser.SystemBrowserInstance ):
Program.findProgram("html")
Turns out Eclipse identifies my "desktop" as DESKTOP_GIO , because I have the GIO library installed as part of some GNOME dependency. Because it ID's me as such it calls this libgio function:
g_app_info_get_default_for_type("text/html", false)
According to the docs , GIO applications use the X Desktop Group (XDG) "standard" Shared MIME-info Database to find applications that support a given MIME type.
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 winebrowser
, since it has a wine-extension-html.desktop
entry in my ~/.local/share/applications/
directory).
In the end I used:
desktop-file-install \
--rebuild-mime-info-cache \
--dir ~/.local/share/applications \
custom-script.desktop
to add a desktop entry for my custom script, and:
xdg-mime default custom-script.desktop text/html
to set it as the default for "html" files.
If you're on a system that has the update-alternatives
command, try to see what update-alternatives --display x-www-browser
gives you - it defines what the default web browser is. use update-alternatives --config x-www-browser
to set it to a specific program.
This is an old question, but I thought I would add what worked for me. I am running Gnome Classic on Debian Wheezy and installed Chromium.
I tried the update-alternatives approach to change the system-wide defaults from Iceweasel to Chromium:
update-alternatives --config x-www-browser
update-alternatives --config gnome-www-browser
but Eclipse was still picking up Iceweasel. I then edited /etc/gnome/defaults.list to replace each instance of 'iceweasel.desktop' to 'chromium.desktop'.
I logged out and back in again, to be sure I get the new defaults, and this time Eclipse used the system browser, Chromium.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.