From 0d23f3e10650ec8e3792cd7a7f0ceaec2ae84fcb Mon Sep 17 00:00:00 2001 From: Jeremy Gailor Date: Mon, 4 Nov 2013 11:20:40 -0800 Subject: [PATCH] Added Canary as a browser --- Side Bar.sublime-settings | 2 +- SideBar.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Side Bar.sublime-settings b/Side Bar.sublime-settings index e52d733f7..e2c0c4952 100755 --- a/Side Bar.sublime-settings +++ b/Side Bar.sublime-settings @@ -24,7 +24,7 @@ "disabled_menuitem_empty": true, //if installed in a default location maybe this works. - "default_browser": "", //one of this list: firefox, chrome, chromium, opera, safari + "default_browser": "", //one of this list: firefox, chrome, canary, chromium, opera, safari "portable_browser": "", // for example: C:/Program Files (x86)/Nightly/firefox.exe diff --git a/SideBar.py b/SideBar.py index 97ea4beb6..028a76871 100755 --- a/SideBar.py +++ b/SideBar.py @@ -1348,6 +1348,32 @@ def try_open(self, url, browser): ]) commands = ['-new-tab', url] + elif browser == 'canary': + if sublime.platform() == 'osx': + items.extend(['open']) + commands = ['-a', '/Applications/Google Chrome Canary.app', url] + elif sublime.platform() == 'windows': + # read local app data path from registry + aKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders") + reg_value, reg_type = winreg.QueryValueEx (aKey, "Local AppData") + + if s.get('portable_browser') != '': + items.extend([s.get('portable_browser')]) + items.extend([ + '%HOMEPATH%\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe' + + ,reg_value+'\\Chrome SxS\\Application\\chrome.exe' + ,reg_value+'\\Google\\Chrome SxS\\Application\\chrome.exe' + ,'%HOMEPATH%\\Google\\Chrome SxS\\Application\\chrome.exe' + ,'%PROGRAMFILES%\\Google\\Chrome SxS\\Application\\chrome.exe' + ,'%PROGRAMFILES(X86)%\\Google\\Chrome SxS\\Application\\chrome.exe' + ,'%USERPROFILE%\\Local\ Settings\\Application\ Data\\Google\\Chrome SxS\\chrome.exe' + ,'%HOMEPATH%\\Local\ Settings\\Application\ Data\\Google\\Chrome SxS\\Application\\chrome.exe' + ,'%HOMEPATH%\\Local Settings\\Application Data\\Google\\Chrome SxS\\Application\\chrome.exe' + ]) + + commands = ['-new-tab', url] + elif browser == 'chromium': if sublime.platform() == 'osx': items.extend(['open'])