From 64e793014b545883c8346a5452ca00e0e06b5848 Mon Sep 17 00:00:00 2001 From: Patrick Haller Date: Thu, 17 Mar 2011 11:32:50 +0800 Subject: added window names and check if mapped --- x-window-list.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/x-window-list.c b/x-window-list.c index a9c1381..9d2c76a 100644 --- a/x-window-list.c +++ b/x-window-list.c @@ -9,7 +9,6 @@ int main(void) { Window root; Window parent; Window *wins; - XClassHint hint; unsigned int nwins; if(!(dpy = XOpenDisplay(NULL))) @@ -17,7 +16,14 @@ int main(void) { XQueryTree(dpy, DefaultRootWindow(dpy), &root, &parent, &wins, &nwins); for (int i=nwins-1; i >= 0; i--) { + XTextProperty name; + XClassHint hint; + XWindowAttributes attr; + XGetClassHint(dpy, wins[i], &hint); - fprintf(stderr, "0x%-10x %s\n", (unsigned int)wins[i], hint.res_name); + XGetWMName(dpy, wins[i], &name); + XGetWindowAttributes(dpy, wins[i], &attr); + if (attr.map_state == IsViewable) + fprintf(stderr, "0x%-10x %s - %s\n", (unsigned int)wins[i], hint.res_name, name.value); } } -- cgit v1.2.3