Which app owns a particular X window?
Someone on a mailing list was trying to figure out what app brought up a particular Gnome window, so she could run it on a machine that didn't have the Gnome desktop menus or panel.Sounded like an interesting puzzle. I found a couple of ways, neither of them totally reliable. They both use xprop.
A lot of apps set something called WM_COMMAND to the original command that was run. So
xprop | grep COMMANDand then click on the window you're interested in, and it gives you something ugly like
WM_COMMAND(STRING) = { "xterm", "-geometry", "80x69+0+0" }
That doesn't seem to work for more modern apps (at least, xchat and firefox don't set WM_COMMAND) so for those, try this:
xprop | grep PID
For apps that support NET_WM_PID, that gives you the process id, e.g.
_NET_WM_PID(CARDINAL) = 4095and then you can
ps aux | grep 4095
Neither method is perfect, and there are a few apps that won't respond to either one. But most will yield to at least one of these approaches.
[ 15:32 Apr 15, 2009 More linux | permalink to this entry | ]