I would like to get a list of windows window names of all open windows in X11 using go. I assume that the xgb package would be used.
CodePudding user response:
You may use C and thus list all windows:
/*
Window *getDisplayWindows (Display *disp, unsigned long *len);
Window *getDisplayWindows (Display *disp, unsigned long *len) {
Atom prop = XInternAtom(disp,"_NET_CLIENT_LIST",False), type;
int form;
unsigned long remain;
unsigned char *list;
if (XGetWindowProperty(disp,XDefaultRootWindow(disp),prop,0,1024,False,XA_WINDOW,
&type,&form,len,&remain,&list) != Success) {
return 0;
}
return (Window*)list;
}
*/
import "C"
//your go code below
I used this for a package of mine to put a window foreground. Hope it helps ?