Get a window handle knowing the PID of a third-party process in Linux lazarus / 32-Linux ---------------------------------------------------------------------- prostor_7_7_7 · 2024-04-26 13:53 How is it possible in Lazarus(linux) to get a window handle knowing the PID of a third-party process in Linux. Perhaps an analogue of the function for Windows enumthreadwindows I looked at the lclintf.pas module, there are some functions from Winapi. But there is no getting a list of HWND windows, running processes ---------------------------------------------------------------------- MarkMLl · 2024-04-26 14:24 Quote from: prostor_7_7_7 on April 26, 2024, 03:53:08 pmHow is it possible in Lazarus(linux) to get a window handle knowing the PID of a third-party process in Linux. Perhaps an analogue of the function for Windows enumthreadwindows I looked at the lclintf.pas module, there are some functions from Winapi. But there is no getting a list of HWND windows, running processes With a lot of difficulty IMO since apart from anything else one PID (on the client program) can be talking to multiple windows (on an X11 server... don't get me going about Wayland). I've had some measure of success parsing the output of xwininfo and xprop, in principle there must be lower-level libraries which could be used but I've not worked out the details. Code: [Select]A complete list of windows may be obtained using e.g. xwininfo -tree -root | less A name pattern may be searched from this, hence e.g. 0x520000c "Untitled * — Kate" The window info may be obtained e.g. xwininfo -id 0x520000c The name may be verified and PID (assuming this is local etc.) obtained e.g. xprop -id 0x520000c WM_NAME _NET_WM_PID Hence the screensaver may also be suspended xdg-screensaver suspend 0x520000c MarkMLl