summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authordoko@ubuntu.com <doko@ubuntu.com>2013-04-13 15:05:11 (GMT)
committerdoko@ubuntu.com <doko@ubuntu.com>2013-04-13 15:05:11 (GMT)
commit66da7c573b8dabbf3bb6fe9de4a05eedd6ee48c3 (patch)
treea54a1a6fc5ec6ffc08e26c3bcecf1136cc5da964 /Lib/webbrowser.py
parentf794b143d32c30f4a910ff19bded3e62c20313e1 (diff)
downloadcpython-66da7c573b8dabbf3bb6fe9de4a05eedd6ee48c3.zip
cpython-66da7c573b8dabbf3bb6fe9de4a05eedd6ee48c3.tar.gz
cpython-66da7c573b8dabbf3bb6fe9de4a05eedd6ee48c3.tar.bz2
- Issue #17536: Add to webbrowser's browser list: xdg-open, gvfs-open,
www-browser, x-www-browser, chromium browsers, iceweasel, iceape.
Diffstat (limited to 'Lib/webbrowser.py')
-rw-r--r--Lib/webbrowser.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index f3c53d4..d3272a0 100644
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -304,6 +304,18 @@ class Galeon(UnixBrowser):
background = True
+class Chrome(UnixBrowser):
+ "Launcher class for Google Chrome browser."
+
+ remote_args = ['%action', '%s']
+ remote_action = ""
+ remote_action_newwin = "--new-window"
+ remote_action_newtab = ""
+ background = True
+
+Chromium = Chrome
+
+
class Opera(UnixBrowser):
"Launcher class for Opera browser."
@@ -441,6 +453,14 @@ class Grail(BaseBrowser):
def register_X_browsers():
+ # use xdg-open if around
+ if _iscommand("xdg-open"):
+ register("xdg-open", None, BackgroundBrowser("xdg-open"))
+
+ # The default GNOME3 browser
+ if "GNOME_DESKTOP_SESSION_ID" in os.environ and _iscommand("gvfs-open"):
+ register("gvfs-open", None, BackgroundBrowser("gvfs-open"))
+
# The default GNOME browser
if "GNOME_DESKTOP_SESSION_ID" in os.environ and _iscommand("gnome-open"):
register("gnome-open", None, BackgroundBrowser("gnome-open"))
@@ -449,9 +469,13 @@ def register_X_browsers():
if "KDE_FULL_SESSION" in os.environ and _iscommand("kfmclient"):
register("kfmclient", Konqueror, Konqueror("kfmclient"))
+ if _iscommand("x-www-browser"):
+ register("x-www-browser", None, BackgroundBrowser("x-www-browser"))
+
# The Mozilla/Netscape browsers
for browser in ("mozilla-firefox", "firefox",
"mozilla-firebird", "firebird",
+ "iceweasel", "iceape",
"seamonkey", "mozilla", "netscape"):
if _iscommand(browser):
register(browser, None, Mozilla(browser))
@@ -471,6 +495,11 @@ def register_X_browsers():
if _iscommand("skipstone"):
register("skipstone", None, BackgroundBrowser("skipstone"))
+ # Google Chrome/Chromium browsers
+ for browser in ("google-chrome", "chrome", "chromium", "chromium-browser"):
+ if _iscommand(browser):
+ register(browser, None, Chrome(browser))
+
# Opera, quite popular
if _iscommand("opera"):
register("opera", None, Opera("opera"))
@@ -489,6 +518,8 @@ if os.environ.get("DISPLAY"):
# Also try console browsers
if os.environ.get("TERM"):
+ if _iscommand("www-browser"):
+ register("www-browser", None, GenericBrowser("www-browser"))
# The Links/elinks browsers <http://artax.karlin.mff.cuni.cz/~mikulas/links/>
if _iscommand("links"):
register("links", None, GenericBrowser("links"))