diff --git a/oml/gtkstatus.py b/oml/gtkstatus.py index 43198a3..883266b 100644 --- a/oml/gtkstatus.py +++ b/oml/gtkstatus.py @@ -2,8 +2,8 @@ import os from os.path import dirname, abspath import subprocess -import time import webbrowser +import _thread import gi gi.require_version('Gtk', '3.0') @@ -23,8 +23,13 @@ class OMLIcon: self.icon.set_title(title) self.icon.connect("activate", self._click) self.icon.connect("popup-menu", self._click) - p = subprocess.Popen([ctl, 'start']) + self._p = subprocess.Popen([ctl, 'start']) GLib.timeout_add_seconds(1, self._open, None) + _thread.start_new_thread(self._wait, ()) + + def _wait(self): + self._p.wait() + self._quit(None) def _click(self, icon, button=None, time=None): if self.menu: