Skip to content

Commit

Permalink
Fix reactivation issues mentioned in #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Saxonbeta committed Jun 15, 2020
1 parent e50ae48 commit bbf0cb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions libqnotero/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from libqnotero.config import getConfig
from threading import Thread


class Listener(Thread):

"""Listens for commands"""
Expand All @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion libqnotero/sysTray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand All @@ -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()
Expand Down

0 comments on commit bbf0cb6

Please sign in to comment.