Open onmyway133 opened 1 year ago
Listen to didActivateApplicationNotification and check that it is not our app
didActivateApplicationNotification
NSWorkspace.shared.notificationCenter .publisher(for: NSWorkspace.didActivateApplicationNotification) .sink(receiveValue: { [weak self] note in guard let app = note.userInfo?[NSWorkspace.applicationUserInfoKey] as? NSRunningApplication, app.bundleIdentifier != Bundle.main.bundleIdentifier else { return } self?.frontMostApp = app }) .store(in: &bag)
Listen to
didActivateApplicationNotification
and check that it is not our app