summaryrefslogtreecommitdiff
path: root/x-window-list.c
diff options
context:
space:
mode:
authorPatrick Haller <patrick@haller.ws>2011-03-17 11:32:50 +0800
committerPatrick Haller <patrick@haller.ws>2011-03-17 11:32:50 +0800
commit64e793014b545883c8346a5452ca00e0e06b5848 (patch)
tree42eef5f704b9ae248cb3384cfda00a525dd5ddd8 /x-window-list.c
parent61d756ab5bd5eba872a616e2cc9c79036077b7a8 (diff)
added window names and check if mapped
Diffstat (limited to 'x-window-list.c')
-rw-r--r--x-window-list.c10
1 files 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);
}
}