diff options
author | Rael <rael.gc@gmail.com> | 2015-10-10 21:28:48 -0300 |
---|---|---|
committer | Rael <rael.gc@gmail.com> | 2015-10-10 21:28:48 -0300 |
commit | 434fbe717b606233ac97878186ff370c16a91a8a (patch) | |
tree | 0eadef8c27aab22baab7dbb3012995d71df55607 | |
parent | 93a1639c6699c36eda6a855045ffc6c37519125b (diff) | |
download | scudcloud-434fbe717b606233ac97878186ff370c16a91a8a.zip scudcloud-434fbe717b606233ac97878186ff370c16a91a8a.tar.gz scudcloud-434fbe717b606233ac97878186ff370c16a91a8a.tar.bz2 |
Another attempt to minimize effects on reconnect scripts (#250)
-rwxr-xr-x | scudcloud-1.0/lib/scudcloud.py | 12 |
1 files changed, 12 insertions, 0 deletions
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) |