aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-14 01:48:19 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-14 01:48:19 +0100
commit2b4685288169616293b279c123f9293fcbcb9deb (patch)
tree119f649cd0aa6f1582ed23ffdcd7b01358fa2e21 /src
parentfix polling (diff)
downloadblueshift-tray-2b4685288169616293b279c123f9293fcbcb9deb.tar.gz
blueshift-tray-2b4685288169616293b279c123f9293fcbcb9deb.tar.bz2
blueshift-tray-2b4685288169616293b279c123f9293fcbcb9deb.tar.xz
fix for fixes in sigusr2 handling
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/blueshift-tray.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/blueshift-tray.py b/src/blueshift-tray.py
index 97cc75e..1da1f62 100755
--- a/src/blueshift-tray.py
+++ b/src/blueshift-tray.py
@@ -104,8 +104,6 @@ def f_toggle(widget, data = None):
if now < last_time + 0.2:
return
last_time = now
- if paused is None:
- paused = False
process.send_signal(signal.SIGUSR2)
icon.set_from_icon_name('blueshift-on' if paused else 'blueshift-off')
paused = not paused
@@ -119,12 +117,8 @@ def f_quit(widget, data = None):
running = False
icon.set_visible(False)
gtk.main_quit()
- if paused is None:
- term()
- elif paused:
- term(2, True)
- else:
- term(2, True)
+ term(1)
+ process.wait()
def f_panic_quit(widget, data = None):
global running
@@ -137,9 +131,9 @@ def f_panic_quit(widget, data = None):
signal.signal(signal.SIGCHLD, process_quit)
-process = subprocess.Popen(['blueshift'] + sys.argv[1:])
+process = subprocess.Popen(['blueshift'] + sys.argv[1:], stdout = sys.stdout, stderr = sys.stderr)
running = True
-paused = None
+paused = False
last_time = time.time() - 1
@@ -176,5 +170,7 @@ finally:
term()
if process.poll() is None:
- process.send_signal(signal.KILL)
+ time.sleep(0.1)
+ if process.poll() is None:
+ process.send_signal(signal.SIGKILL)