Re: Window -> PID

From: Alan Coopersmith (alanc_at_alum.calberkeley.org)
Date: 11/20/05


Date: Sun, 20 Nov 2005 22:31:37 +0000 (UTC)


<bunka.munka@yahoo.com> writes in comp.unix.solaris:
|Sometimes, I have an application running in Window and want to
|know the PID. Is there a way I can get it somehow digging into
|structures, if I know the Window ID (obtained by xwininfo) ?

Not really easily. (On most OS'es, it's a flat out no - on Solaris,
with Xsun, the X server knows the pid for each client in order to do the
IA process priority manipulations, so you can dig it out with debugger
magic, but that's not something you'ld want to include in a script or
program (though I have).)

The best way to do this would be get the applications you care about
to set the _NET_WM_PID property - see the Extended WM spec at:
http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2511832

-- 
Alan Coopersmith * alanc@alum.calberkeley.org * Alan.Coopersmith@Sun.COM
  http://blogs.sun.com/alanc/ *  http://people.freedesktop.org/~alanc/
   http://del.icio.us/alanc/  *  http://www.csua.berkeley.edu/~alanc/
  Working for, but definitely not speaking for, Sun Microsystems, Inc.


Relevant Pages

  • Re: Window -> PID
    ... the X server knows the pid for each client in order to do the ... |I am familiar with the most kernel structures (actually i am digging ... |pid> and moving mouse over that window produce a massive ... no way to get it out other than via poking in the X server process ...
    (comp.unix.solaris)
  • Re: Window -> PID
    ... I have an application running in Window and want to ... > know the PID. ... Is there a way I can get it somehow digging into ... something which is interacting with the X server. ...
    (comp.unix.solaris)
  • Re: Window -> PID
    ... Is there a way I can get it somehow digging into ... the X server knows the pid for each client in order to do the ... with adb into crash files many times), ... pid> and moving mouse over that window produce a massive ...
    (comp.unix.solaris)
  • Re: OpenProcess Identify Handle
    ... a given PID, and not a hwnd If it helps, here's a snip that finds ... process PID, you can use GetWindowThreadProcessId: ... each call to OpenProcess returns a proc handle unique to the ... >Is is possible to set where a window will open using an API calls? ...
    (microsoft.public.vb.winapi)
  • Re: Fenster mit Fokus finden
    ... brauche ich die PID des Prozesses. ... static Window Select_Window; ...
    (de.comp.os.unix.x11)