How To Identify Process From A Toolbar Icon or Window? How does one identify which process is behind a certain tool bar icon without having to rely on asking someone on the know or just killing processes until the icon in question magically disappears? For X11 there are tools like xwininfo. Is there anything similar for (older) OS X versions like Mavericks?

An example case: How to figure which process (by process ID) has produced the highlighted icon on my toolbar? I'm happy to do some programming if necessary, but would rather not reinvent the wheel here.

 

A partial solution to this problem would be to use Accessibility Inspector, as described on one of answers. However, quite often it does not reveal enough information (nor does it allow one to go get all the way to the process ID without some manual labor on the way).

For example, for the icon above Accessibility Inspector is not much of help:
You can use Accessibility Inspector bundled with Xcode. Then select the element and press ⌘CMD+F7 to lock the element. Then Select AXApplication in "Hierarchy" and then Go To Element button. There under the accessibilityTitle You'll have the name of the application.

Here's the screenshot where You can find 1Keyboard app selected.