tnew tool: ignw - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 0c076cbec593e4b8b14ba88521793f4ceb6141f0
 (DIR) parent d6536fa10c3dfcabbfc644dc8301a1c7d562d5c6
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Tue,  2 Dec 2014 14:07:04 +0100
       
       new tool: ignw
       
       Diffstat:
         M Makefile                            |       3 ++-
         M README.md                           |       1 +
         A ignw.c                              |      51 +++++++++++++++++++++++++++++++
       
       3 files changed, 54 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/Makefile b/Makefile
       t@@ -18,7 +18,8 @@ SRC =           \
                chwso.c \
                wtf.c   \
                wrs.c   \
       -        chwb.c
       +        chwb.c  \
       +        ignw.c
        
        OBJ = $(SRC:.c=.o)
        BIN = $(SRC:.c=)
 (DIR) diff --git a/README.md b/README.md
       t@@ -29,6 +29,7 @@ without being added to this list, so take it with a grain of salt.
        
        * chwb  - change window's border
        * chwso - change window stack order
       +* ignw  - mark window as ignored
        * killw - kill windows
        * lsw   - list windows
        * mapw  - map/unmap windows
 (DIR) diff --git a/ignw.c b/ignw.c
       t@@ -0,0 +1,51 @@
       +#include <stdio.h>
       +#include <stdlib.h>
       +#include <err.h>
       +#include <xcb/xcb.h>
       +
       +#include "arg.h"
       +
       +char *argv0;
       +static xcb_connection_t *conn;
       +
       +static void xcbinit(void);
       +static void cleanup(void);
       +static void ignore(xcb_window_t);
       +
       +static void
       +xcbinit(void)
       +{
       +        conn = xcb_connect(NULL, NULL);
       +        if (xcb_connection_has_error(conn))
       +                errx(1, "unable connect to the X server");
       +}
       +
       +static void
       +cleanup(void)
       +{
       +        if (conn != NULL)
       +                xcb_disconnect(conn);
       +}
       +
       +static void
       +ignore(xcb_window_t w)
       +{
       +        uint32_t mask = XCB_CW_OVERRIDE_REDIRECT;
       +        uint32_t val[] = { 1 };
       +
       +        xcb_change_window_attributes(conn, w, mask, val);
       +}
       +
       +int
       +main(int argc, char **argv)
       +{
       +        atexit(cleanup);
       +        xcbinit();
       +
       +        while (*argv)
       +                ignore(strtoul(*argv++, NULL, 16));
       +
       +        xcb_flush(conn);
       +
       +        return 0;
       +}