[Pkg-privacy-commits] [torbrowser-launcher] 06/14: Remove code to bring windows to front, and to get pid of processes, because these stopped working long ago. Also remove wmctrl dependency.

Holger Levsen holger at moszumanska.debian.org
Sat Dec 5 14:30:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch debian/sid
in repository torbrowser-launcher.

commit 409ee9d384a73f3ee9477ff7cc7908cc7a2dbea6
Author: Micah Lee <micah at micahflee.com>
Date:   Sun Nov 8 17:30:47 2015 -0800

    Remove code to bring windows to front, and to get pid of processes, because these stopped working long ago. Also remove wmctrl dependency.
---
 BUILD.md                             |  4 ++--
 apparmor/usr.bin.torbrowser-launcher |  2 +-
 build_rpm.sh                         |  2 +-
 stdeb.cfg                            |  2 +-
 torbrowser_launcher/__init__.py      |  7 ------
 torbrowser_launcher/common.py        | 41 ------------------------------------
 torbrowser_launcher/launcher.py      |  9 --------
 7 files changed, 5 insertions(+), 62 deletions(-)

diff --git a/BUILD.md b/BUILD.md
index 5cc48e0..17199c7 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -12,7 +12,7 @@ Then install dependencies, build a package, and install:
 ### Debian, Ubuntu, Linux Mint, etc.
 
 ```sh
-sudo apt-get install build-essential dh-python python-all python-stdeb python-gtk2 python-psutil python-twisted python-lzma python-txsocksx wmctrl gnupg fakeroot xz-utils tor
+sudo apt-get install build-essential dh-python python-all python-stdeb python-gtk2 python-psutil python-twisted python-lzma python-txsocksx gnupg fakeroot xz-utils tor
 ./build_deb.sh
 sudo dpkg -i deb_dist/torbrowser-launcher_*.deb
 ```
@@ -22,7 +22,7 @@ Optionally you can install `python-pygame` if you want to play a modem sound whi
 ### Red Hat, Fedora, CentOS, etc.
 
 ```sh
-sudo yum install python-psutil python-twisted wmctrl gnupg fakeroot rpm-build python-txsocksx tor pygtk2
+sudo yum install python-psutil python-twisted gnupg fakeroot rpm-build python-txsocksx tor pygtk2
 ./build_rpm.sh
 sudo yum install dist/torbrowser-launcher-*.rpm
 ```
diff --git a/apparmor/usr.bin.torbrowser-launcher b/apparmor/usr.bin.torbrowser-launcher
index 3eb61f9..025dd2a 100644
--- a/apparmor/usr.bin.torbrowser-launcher
+++ b/apparmor/usr.bin.torbrowser-launcher
@@ -36,7 +36,7 @@
   @{PROC}/tty/drivers r,
   @{PROC}/uptime r,
   /usr/bin/ r,
-  /usr/bin/{gpg,wmctrl,dirname,expr,file,getconf,id} rix,
+  /usr/bin/{gpg,dirname,expr,file,getconf,id} rix,
   /usr/bin/torbrowser-launcher r,
   /usr/share/file/magic.mgc r,
   /usr/share/file/magic/ r,
diff --git a/build_rpm.sh b/build_rpm.sh
index 15475dd..b0f2ba6 100755
--- a/build_rpm.sh
+++ b/build_rpm.sh
@@ -6,7 +6,7 @@ VERSION=`cat share/torbrowser-launcher/version`
 rm -r build dist
 
 # build binary package
-python setup.py bdist_rpm --requires="python-psutil, python-twisted, python-txsocksx, wmctrl, gnupg, fakeroot, tor, pygtk2"
+python setup.py bdist_rpm --requires="python-psutil, python-twisted, python-txsocksx, gnupg, fakeroot, tor, pygtk2"
 
 # install it
 echo ""
diff --git a/stdeb.cfg b/stdeb.cfg
index 717d4aa..838af4a 100644
--- a/stdeb.cfg
+++ b/stdeb.cfg
@@ -1,6 +1,6 @@
 [DEFAULT]
 Package: torbrowser-launcher
-Depends: python-gtk2, python-psutil, python-twisted, python-lzma, gnupg, wmctrl, xz-utils, python-txsocksx, tor
+Depends: python-gtk2, python-psutil, python-twisted, python-lzma, gnupg, xz-utils, python-txsocksx, tor
 Build-Depends: dh-python
 Recommends: python-pygame
 Suite: trusty
diff --git a/torbrowser_launcher/__init__.py b/torbrowser_launcher/__init__.py
index 5807117..a03d639 100644
--- a/torbrowser_launcher/__init__.py
+++ b/torbrowser_launcher/__init__.py
@@ -53,13 +53,6 @@ def main():
 
     common = Common(tor_browser_launcher_version)
 
-    # is torbrowser-launcher already running?
-    tbl_pid = common.get_pid(common.paths['tbl_bin'], True)
-    if tbl_pid:
-        print _('Tor Browser Launcher is already running (pid {0}), bringing to front').format(tbl_pid)
-        common.bring_window_to_front(tbl_pid)
-        sys.exit()
-
     if settings:
         # settings mode
         app = Settings(common)
diff --git a/torbrowser_launcher/common.py b/torbrowser_launcher/common.py
index 2df0161..0b89a30 100644
--- a/torbrowser_launcher/common.py
+++ b/torbrowser_launcher/common.py
@@ -235,44 +235,3 @@ class Common:
         json.dump(self.settings, open(self.paths['settings_file'], 'w'))
         return True
 
-    # get the process id of a program
-    @staticmethod
-    def get_pid(bin_path, python=False):
-        pid = None
-
-        for p in psutil.process_iter():
-            try:
-                if p.pid != os.getpid():
-                    exe = None
-                    if python:
-                        if len(p.cmdline) > 1:
-                            if 'python' in p.cmdline[0]:
-                                exe = p.cmdline[1]
-                    else:
-                        if len(p.cmdline) > 0:
-                            exe = p.cmdline[0]
-
-                    if exe == bin_path:
-                        pid = p.pid
-
-            except:
-                pass
-
-        return pid
-
-    # bring program's x window to front
-    @staticmethod
-    def bring_window_to_front(pid):
-        # figure out the window id
-        win_id = None
-        p = subprocess.Popen(['wmctrl', '-l', '-p'], stdout=subprocess.PIPE)
-        for line in p.stdout.readlines():
-            line_split = line.split()
-            cur_win_id = line_split[0]
-            cur_win_pid = int(line_split[2])
-            if cur_win_pid == pid:
-                win_id = cur_win_id
-
-        # bring to front
-        if win_id:
-            subprocess.call(['wmctrl', '-i', '-a', win_id])
diff --git a/torbrowser_launcher/launcher.py b/torbrowser_launcher/launcher.py
index ff4adcd..b90b34c 100644
--- a/torbrowser_launcher/launcher.py
+++ b/torbrowser_launcher/launcher.py
@@ -100,15 +100,6 @@ class Launcher:
                 self.common.settings['update_over_tor'] = False
                 self.common.save_settings()
 
-        # is firefox already running?
-        if self.common.settings['installed_version']:
-            firefox_pid = self.common.get_pid('./Browser/firefox')
-            if firefox_pid:
-                print _('Firefox is open, bringing to focus')
-                # bring firefox to front
-                self.common.bring_window_to_front(firefox_pid)
-                return
-
         # check for updates?
         check_for_updates = False
         if self.common.settings['check_for_updates']:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git



More information about the Pkg-privacy-commits mailing list