I am using AXUIElement to find out all running application in Mac OS. Using it, when I move mouse I get all application names when mouse over any application.
But I want to filter out the applications which user has selected and have done any interaction in it. I am getting parameters such as AXFocused, AXEnabled, AXSelected, but those parameters don't return true every time the application get selected.
"\nAttributes:\n AXFocused (W): “0”\n AXLayoutCount: “24”\n AXTitle: “”\n AXPreventKeyboardDOMEventDispatch (W): “0”\n AXElementBusy: “0”\n AXPosition: “x=1260 y=219”\n AXLinkedUIElements: “”\n AXSelected: “0”\n AXLanguage: “”\n AXStartTextMarker: “{length = 40, bytes = 0x060000000000000048730e6205000000 ... 0100000000000000}”\n AXEnabled: “1”\n AXLoaded: “1”\n AXVisited: “0”\n AXDOMIdentifier: “”\n AXHelp: “”\n AXLinkUIElements: “”\n AXChildren: “”\n AXRole: “AXWebArea”\n AXParent: “”\n AXSelectedTextMarkerRange (W): “{startMarker:{length = 40, bytes = 0x1300000000000000a853046205000000 ... 0100000000000000} endMarker:{length = 40, bytes = 0x1300000000000000a853046205000000 ... 0100000000000000}}”\n AXTopLevelUIElement: “”\n AXDOMClassList: “”\n AXDescription: “MacRumors Newsletter”\n AXURL: “x-webdoc://21082B85-5712-4B41-9669-1BF2A39AA32D”\n AXCaretBrowsingEnabled (W): “0”\n AXValue: “”\n AXBlockQuoteLevel: “0”\n AXRoleDescription: “HTML content”\n AXSize: “w=785 h=3416”\n AXLoadingProgress: “1”\n AXWindow: “”\n AXEndTextMarker: “{length = 40, bytes = 0x35010000000000007042fe6505000000 ... 0100000000000000}”\n AXFrame: “x=1260 y=219 w=785 h=3416”\n\nActions:\n AXShowMenu - show menu\n AXScrollToVisible - AXScrollToVisible\n"
For example above is of, when I opened "Mail".
so my questions are : 1) is it possible to filter out application which user has selected not just mouse over it? 2) is there any other way I could find out which application user was interacting with before accessing my app?