wmutils

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

commit 03cef85acf3e85baed24879027cd1aa956d4c478
parent 4662d2794e6e368f709d892bd1cdc225d01f2c7b
Author: z3bra <willy@mailoo.org>
Date:   Thu Dec  4 00:33:45 2014

wattr: added a check for ignored windows

Diffstat:
 wattr.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/wattr.c b/wattr.c @@ -21,13 +21,14 @@ enum { ATTR_Y = 1 << 3, ATTR_B = 1 << 4, ATTR_M = 1 << 5, + ATTR_I = 1 << 6, ATTR_MAX }; static void usage(void) { - fprintf(stderr, "usage: %s [-h] [bmwhxy] <wid>\n", argv0); + fprintf(stderr, "usage: %s [-h] [bmiwhxy] <wid>\n", argv0); exit(1); } @@ -82,6 +83,25 @@ mapped(xcb_window_t w) } 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 int getattribute(xcb_window_t w, int attr) { xcb_get_geometry_cookie_t c; @@ -128,6 +148,7 @@ main(int argc, char **argv) case 'x': printf("%d", getattribute(w, ATTR_X)); break; case 'y': printf("%d", getattribute(w, ATTR_Y)); break; case 'w': printf("%d", getattribute(w, ATTR_W)); break; + case 'i': ignored(w)? exit(0) : exit(1); case 'm': mapped(w) ? exit(0) : exit(1); default : exists(w) ? exit(0) : exit(1); }