I am working on an app, with speech to text functionality, in which I have to add text in third party app when user speak something ,in Mac osx. My question is , is there any way i can detect if user has focused on editing area only. I can detect which app it is using
NSWorkspace.shared.notificationCenter.addObserver(self, // HERE, shared
selector: #selector(printMe(_:)),
name: NSWorkspace.didActivateApplicationNotification, // HERE
object:nil)
,which gives app name. But it's not that useful as if user open any non text editing app and start speaking.
Is there any way we can detect if user has focused on editor in third party app using AppleScript or Accessibility or any other way?