diff --git a/libqnotero/listener.py b/libqnotero/listener.py index 2f2eb4a..359316a 100644 --- a/libqnotero/listener.py +++ b/libqnotero/listener.py @@ -20,6 +20,7 @@ from libqnotero.config import getConfig from threading import Thread + class Listener(Thread): """Listens for commands""" @@ -38,12 +39,12 @@ def __init__(self, qnotero=None): self.alive = True Thread.__init__(self) self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - self.sock.bind(("", self.port)) + self.sock.bind((u"localhost", self.port)) self.sock.settimeout(1.) def run(self): - """Listenes for activation signals and pops up the Qnotero window""" + """Listen for activation signals and pops up the Qnotero window""" while self.alive: try: diff --git a/libqnotero/sysTray.py b/libqnotero/sysTray.py index 9768f4e..3b554b1 100644 --- a/libqnotero/sysTray.py +++ b/libqnotero/sysTray.py @@ -41,6 +41,7 @@ def __init__(self, qnotero): self.menu = QMenu() self.re_init() self.activated.connect(self.activate) + self.listenerActivated.connect(self.activate) def activate(self, reason=None): @@ -51,7 +52,7 @@ def activate(self, reason=None): reason -- the reason for activation (default=None) """ - if reason == QSystemTrayIcon.Context or platform.system() == 'Darwin': + if reason == QSystemTrayIcon.Context or (platform.system() == 'Darwin' and reason is not None): return if self.qnotero.isVisible(): self.qnotero.popDown()