wmutils

X windows manipulation utilities
git clone git://z3bra.org/wmutils
Log | Files | Refs | LICENSE

commit d6536fa10c3dfcabbfc644dc8301a1c7d562d5c6
parent 7362053d6865989c655e2089b88986d4462d5498
Author: z3bra <willy@mailoo.org>
Date:   Tue Dec  2 14:06:45 2014

lsw: ignore windows with override_redirect set to 1

Diffstat:
 lsw.c | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/lsw.c b/lsw.c @@ -12,7 +12,8 @@ static xcb_screen_t *scrn; static void usage(void); static void xcbinit(void); static void cleanup(void); -static int ismapped(xcb_window_t w); +static int mapped(xcb_window_t); +static int ignored(xcb_window_t); static void usage(void) @@ -42,7 +43,7 @@ cleanup(void) } static int -ismapped(xcb_window_t w) +mapped(xcb_window_t w) { int ms; xcb_get_window_attributes_cookie_t c; @@ -60,6 +61,25 @@ ismapped(xcb_window_t w) return ms; } +static int +ignored(xcb_window_t w) +{ + int or; + xcb_get_window_attributes_cookie_t c; + xcb_get_window_attributes_reply_t *r; + + c = xcb_get_window_attributes(conn, w); + r = xcb_get_window_attributes_reply(conn, c, NULL); + + if (r == NULL) + return 0; + + or = r->override_redirect; + + free(r); + return or; +} + static void listwindows(xcb_window_t w, int listhidden) { @@ -78,8 +98,10 @@ listwindows(xcb_window_t w, int listhidden) errx(1, "0x%08x: unable to retrieve children", w); for (i=0; i<r->children_len; i++) { - if (ismapped(wc[i]) || listhidden) - printf("0x%08x\n", wc[i]); + if (!ignored(wc[i])) { + if (mapped(wc[i]) || listhidden) + printf("0x%08x\n", wc[i]); + } } free(r);