Skip to content

Instantly share code, notes, and snippets.

@SergioGeeK7
Created November 7, 2013 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SergioGeeK7/7357582 to your computer and use it in GitHub Desktop.
Save SergioGeeK7/7357582 to your computer and use it in GitHub Desktop.
import sublime, sublime_plugin
# import webbrowser
# import os
import subprocess
class RunInBrowserCommand(sublime_plugin.TextCommand):
def run(self, edit):
url = self.view.file_name()
print "[i] filename: " + url
url = url.replace('\\', '/')
# replace path
url = url.replace('/opt/lampp/htdocs', 'http://localhost')
print "[i] url: " + url
# firefox = webbrowser.get('mozilla')
# firefox.open_new(url)
# webbrowser.open_new(url)
# subprocess.call([r"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", url])
#os.system("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", url)
# os.spawnl(os.P_NOWAIT, "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", r'FireFox', '-new-tab', url)
pid = subprocess.Popen(["/usr/bin/google-chrome","-incognito", url]).pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment