]> git.lizzy.rs Git - torbrowser-launcher.git/commitdiff
fixes most of #17
authorMicah Lee <micahflee@riseup.net>
Mon, 8 Apr 2013 17:56:06 +0000 (10:56 -0700)
committerMicah Lee <micahflee@riseup.net>
Mon, 8 Apr 2013 17:56:06 +0000 (10:56 -0700)
README
torbrowser-launcher

diff --git a/README b/README
index 0ce83f7349eff3ed9f3e14e7cf176e678504c00b..30d0c987aa6868106cad33248dde0f4e209e1c05 100644 (file)
--- a/README
+++ b/README
@@ -29,7 +29,7 @@ install it like this:
 
 Also install the torbrowser-launcher dependencies:
 
-  apt-get install tor python-gtk2 gnupg python-twisted
+  apt-get install tor python-gtk2 python-psutil gnupg python-twisted
 
 Building
 --------
index 0e65e91b4bd72ed2766b6d38e4279969dc7a1f70..502a92c454f80141807b956bed6e760194d40cd0 100755 (executable)
@@ -11,7 +11,7 @@ import pygtk
 pygtk.require('2.0')
 import gtk
 
-import os, sys, subprocess, locale, urllib2, gobject, time, pickle, json, tarfile
+import os, sys, subprocess, locale, urllib2, gobject, time, pickle, json, tarfile, psutil
 
 from twisted.web.client import Agent, ResponseDone
 from twisted.web.http_headers import Headers
@@ -61,6 +61,24 @@ class TorBrowserLauncher:
             if self.load_settings():
                 self.build_paths(self.settings['latest_version'])
 
+                # is tbb already running and we just need to open a new firefox?
+                if self.settings['installed_version']:
+                    vidalia_pid = None
+                    firefox_pid = None
+                    for p in psutil.process_iter():
+                        try:
+                            if p.exe == self.paths['file']['vidalia_bin']:
+                                vidalia_pid = p.exe
+                            if p.exe == self.paths['file']['firefox_bin']:
+                                firefox_pid = p.exe
+                        except:
+                            pass
+
+                    if vidalia_pid and not firefox_pid:
+                        print _('Vidalia is already open, but firefox is closed. Launching new firefox.')
+                        subprocess.Popen([self.paths['file']['firefox_bin'], '-no-remote', '-profile', self.paths['file']['firefox_profile']])
+                        return
+
                 # how long was it since the last update check?
                 # 86400 seconds = 24 hours
                 current_timestamp = int(time.time())
@@ -190,6 +208,9 @@ class TorBrowserLauncher:
                     'settings': tbb_data+'/settings',
                     'version': tbb_data+'/version',
                     'start': tbb_data+'/tbb/'+self.architecture+'/tor-browser_'+self.language+'/start-tor-browser',
+                    'vidalia_bin': tbb_data+'/tbb/'+self.architecture+'/tor-browser_'+self.language+'/App/vidalia',
+                    'firefox_bin': tbb_data+'/tbb/'+self.architecture+'/tor-browser_'+self.language+'/App/Firefox/firefox',
+                    'firefox_profile': tbb_data+'/tbb/'+self.architecture+'/tor-browser_'+self.language+'/Data/profile',
                     'update_check': tbb_data+'/download/RecommendedTBBVersions',
                     'icon': '/usr/share/pixmaps/torbrowser80.xpm',
                     'torproject_pem': '/usr/share/torbrowser-launcher/torproject.pem',