From a48a5deb3f174d9138edf7aa34cdc5d1f81774af Mon Sep 17 00:00:00 2001 From: Abhishek Date: Fri, 11 Feb 2022 20:04:47 -0500 Subject: [PATCH] Fixes. --- .../xcshareddata/xcschemes/Clocker.xcscheme | 1 - Clocker/Preferences/Menu Bar/StatusItemHandler.swift | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Clocker/Clocker.xcodeproj/xcshareddata/xcschemes/Clocker.xcscheme b/Clocker/Clocker.xcodeproj/xcshareddata/xcschemes/Clocker.xcscheme index b23767c..0cfb133 100644 --- a/Clocker/Clocker.xcodeproj/xcshareddata/xcschemes/Clocker.xcscheme +++ b/Clocker/Clocker.xcodeproj/xcshareddata/xcschemes/Clocker.xcscheme @@ -78,7 +78,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - enableAddressSanitizer = "YES" enableASanStackUseAfterReturn = "YES" enableUBSanitizer = "YES" launchStyle = "0" diff --git a/Clocker/Preferences/Menu Bar/StatusItemHandler.swift b/Clocker/Preferences/Menu Bar/StatusItemHandler.swift index be1f913..e44f657 100644 --- a/Clocker/Preferences/Menu Bar/StatusItemHandler.swift +++ b/Clocker/Preferences/Menu Bar/StatusItemHandler.swift @@ -118,6 +118,14 @@ class StatusItemHandler: NSObject { queue: mainQueue) { _ in self.setupStatusItem() } + + NSWorkspace.shared.notificationCenter.addObserver(forName: NSWorkspace.willSleepNotification, object: nil, queue: OperationQueue.main) { notification in + self.menubarTimer?.invalidate() + } + + NSWorkspace.shared.notificationCenter.addObserver(forName: NSWorkspace.didWakeNotification, object: nil, queue: OperationQueue.main) { notification in + self.setupStatusItem() + } } deinit {