From 434fbe717b606233ac97878186ff370c16a91a8a Mon Sep 17 00:00:00 2001 From: Rael Date: Sat, 10 Oct 2015 21:28:48 -0300 Subject: Another attempt to minimize effects on reconnect scripts (#250) --- scudcloud-1.0/lib/scudcloud.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scudcloud-1.0/lib/scudcloud.py b/scudcloud-1.0/lib/scudcloud.py index b85de4d..ad9dfcc 100755 --- a/scudcloud-1.0/lib/scudcloud.py +++ b/scudcloud-1.0/lib/scudcloud.py @@ -70,6 +70,18 @@ class ScudCloud(QtGui.QMainWindow): self.statusBar().showMessage('Loading Slack...') # Starting unread msgs counter self.setupTimer() + # Watch for suspend/resume events + if DBusQtMainLoop is not None: + DBusQtMainLoop(set_as_default=True) + dbus.SystemBus().add_signal_receiver(self.sleep, 'PrepareForSleep', 'org.freedesktop.login1.Manager', 'org.freedesktop.login1') + + def sleep(self, suspended): + # We want the Resume event + if not suspended: + self.timer.stop() + # Let's give some time to Slack run reconnect scripts + time.sleep(60) + self.timer.start() def addWrapper(self, url): webView = Wrapper(self) -- cgit v1.1