diff options
Diffstat (limited to '')
-rwxr-xr-x | src/blueshift-tray.py | 35 |
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) |