Search code examples
linuxprocessxlibxorgxserver

does Xlib have any library call for Window associated process ID?


goal: is to collect information about user interactive program in Tracking app.

most efficient way is through process ID. the only way i can think of is getting Xlib Window associated process ID, does other ways around?

going through documentation, and source code, no clue for Window associated process ID attribute, maybe Xlib doesn't keep PID, or does it?

non efficient solution is through Window name attribute.


Solution

  • Xlib doesn't keep process ids - it was designed to work on a variety of OS'es with different process abstractions, and across networks, where a pid on one machine isn't very useful on another machine.

    But since most X applications today are being run on Unix-like machines and displayed locally, not over the network, many modern toolkits adopted a convention of storing the process id in a property on the window of that application. See the _NET_WM_PID section of the Extended Window Manager Hints specification for details.