From b1fb8bef64d63e00d67be40b36e2c82a0c9d9dc7 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 8 Jun 2017 16:40:23 +0800 Subject: add filter out of unmanaged windows, add (un)mapped indicator to output --- x-window-list.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/x-window-list.c b/x-window-list.c index 208d75a..7306c9b 100644 --- a/x-window-list.c +++ b/x-window-list.c @@ -27,7 +27,9 @@ void x_window_list(Config cfg, Display *dpy, Window *wins, unsigned int nwins) { XTextProperty name; XClassHint hint; - if (!XGetWindowAttributes(dpy, *w, &attr)) + if (! XGetWMHints(dpy, *w)) + continue; + if (! XGetWindowAttributes(dpy, *w, &attr)) continue; if (attr.override_redirect) continue; @@ -38,8 +40,11 @@ void x_window_list(Config cfg, Display *dpy, Window *wins, unsigned int nwins) { XGetClassHint(dpy, *w, &hint); XGetWMName(dpy, *w, &name); - - printf("0x%-12x %s - %s\n",(unsigned int)*w, hint.res_name, name.value); + printf("0x%-12x %s %s - %s\n", + (unsigned int)*w, + attr.map_state == IsUnmapped ? "U":"M", + hint.res_name, name.value + ); } } -- cgit v1.2.3