[comp.windows.x] xlsclients

tek@CS.UCLA.EDU (03/07/89)

X11 has programs such as "xlsfonts" and "xlswins". 

How would you write a program that would list the current clients of a
server? In other words, how would you write "xlsclients"?

I could not find any Xlib calls that would tell you about other
clients. Have I overlooked something?

Ted Kim                           ARPAnet: tek@penzance.cs.ucla.edu
UCLA Computer Science Department  UUCP:    ...!ucbvax!cs.ucla.edu!tek
3804C Boelter Hall                PHONE:   (213) 206-8696
Los Angeles, CA 90024             ESPnet:  tek@ouija.board

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (03/08/89)

> X11 has programs such as "xlsfonts" and "xlswins".
> 
> How would you write a program that would list the current clients of a
> server? In other words, how would you write "xlsclients"?

The core protocol provides no information about other connections to the
server.  However, the ICCCM does encourage clients to put various useful
properties on their top level windows.  The general idea would be to loop over
windows finding the highest ones that have a WM_STATE property attached (the
window manager puts this property on them to distinguish client windows from wm
windows used for decoration and the like).  For these windows you could then
print out some combination of the WM_NAME, WM_ICON_NAME, WM_COMMAND, and
WM_CLIENT_MACHINE properties.