aboutsummaryrefslogtreecommitdiffstats
path: root/src/blueshift-tray.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-22 04:11:01 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-22 04:11:01 +0100
commit9b637ace2f430e954165f90ee6293e15eb00b79f (patch)
tree6a5f0a2cfd10dbb586b60ee93ff4f43d8498fb84 /src/blueshift-tray.py
parentm (diff)
downloadblueshift-tray-9b637ace2f430e954165f90ee6293e15eb00b79f.tar.gz
blueshift-tray-9b637ace2f430e954165f90ee6293e15eb00b79f.tar.bz2
blueshift-tray-9b637ace2f430e954165f90ee6293e15eb00b79f.tar.xz
support non-continuous mode
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-xsrc/blueshift-tray.py35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/blueshift-tray.py b/src/blueshift-tray.py
index a16983e..0e14e43 100755
--- a/src/blueshift-tray.py
+++ b/src/blueshift-tray.py
@@ -33,7 +33,17 @@ gettext.bindtextdomain('blueshift', LOCALEDIR)
gettext.textdomain('blueshift')
+def process_quit(signum, frame):
+ global running
+ process.wait()
+ if running:
+ running = False
+ icon.set_visible(False)
+ gtk.main_quit()
+
+signal.signal(signal.SIGCHLD, process_quit)
process = subprocess.Popen(['blueshift'] + sys.argv[1:])
+running = True
def create_menu(menu, image, title, function):
@@ -58,17 +68,23 @@ def f_reload(widget, data = None):
process.send_signal(signal.SIGUSR1)
def f_quit(widget, data = None):
- icon.set_visible(False)
- gtk.main_quit()
- process.send_signal(signal.SIGTERM)
+ global running
+ if running:
+ running = False
+ icon.set_visible(False)
+ gtk.main_quit()
+ process.send_signal(signal.SIGTERM)
def f_panic_quit(widget, data = None):
- icon.set_visible(False)
- gtk.main_quit()
- process.send_signal(signal.SIGTERM)
- import time
- time.sleep(0.01)
- process.send_signal(signal.SIGTERM)
+ global running
+ if running:
+ running = False
+ icon.set_visible(False)
+ gtk.main_quit()
+ process.send_signal(signal.SIGTERM)
+ import time
+ time.sleep(0.01)
+ process.send_signal(signal.SIGTERM)
def f_popup(widget, button, time, data = None):
@@ -95,6 +111,7 @@ try:
gtk.main()
except KeyboardInterrupt:
+ running = False
icon.set_visible(False)
process.send_signal(signal.SIGTERM)