diff --git a/xpra/platform/darwin/gui.py b/xpra/platform/darwin/gui.py index f575121b39..583ece885e 100644 --- a/xpra/platform/darwin/gui.py +++ b/xpra/platform/darwin/gui.py @@ -584,10 +584,10 @@ def normalize_precision(distance): @objc.python_method def register_sleep_handlers(self): log("register_sleep_handlers()") - workspace = NSWorkspace.sharedWorkspace() - notificationCenter = workspace.notificationCenter() + self.workspace = NSWorkspace.sharedWorkspace() + self.notificationCenter = self.workspace.notificationCenter() def add_observer(fn, val): - notificationCenter.addObserver_selector_name_object_(self, fn, val, None) + self.notificationCenter.addObserver_selector_name_object_(self, fn, val, None) #NSWorkspaceWillPowerOffNotification add_observer(self.receiveSleepNotification_, NSWorkspaceWillSleepNotification) add_observer(self.receiveWakeNotification_, NSWorkspaceDidWakeNotification)