wmutils

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

commit 0c076cbec593e4b8b14ba88521793f4ceb6141f0
parent d6536fa10c3dfcabbfc644dc8301a1c7d562d5c6
Author: z3bra <willy@mailoo.org>
Date:   Tue Dec  2 14:07:04 2014

new tool: ignw

Diffstat:
 Makefile  |  3 ++-
 README.md |  1 +
 ignw.c    | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -18,7 +18,8 @@ SRC = \ chwso.c \ wtf.c \ wrs.c \ - chwb.c + chwb.c \ + ignw.c OBJ = $(SRC:.c=.o) BIN = $(SRC:.c=) diff --git a/README.md b/README.md @@ -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 diff --git a/ignw.c b/ignw.c @@ -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; +}