Applescript does not work for me but you can use `Accessibility Inspector.app` (bundled with XCode), see https://apple.stackexchange.com/questions/232416/how-to-identify-process-from-a-toolbar-icon-or-window/232427#232427