wmutils

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

commit 1be37b684a7d4e5fc3cc755330b311e2634a8ef4
parent 4acb2c2c6466433eeec51f4bdd762f6fe799e0bc
Author: dcat <dcat@iotek.org>
Date:   Thu Jun 25 19:16:49 2015

rm wname

Diffstat:
 Makefile     |  1 +-
 man/Makefile |  1 +-
 man/wname.1  | 18 +-----------------
 wname.c      | 65 +-------------------------------------------------------------
 4 files changed, 0 insertions(+), 85 deletions(-)

diff --git a/Makefile b/Makefile @@ -14,7 +14,6 @@ SRC = \ wrs.c \ chwb.c \ ignw.c \ - wname.c \ wmp.c OBJ = $(SRC:.c=.o) diff --git a/man/Makefile b/man/Makefile @@ -13,7 +13,6 @@ MAN = \ wrs.1 \ chwb.1 \ ignw.1 \ - wname.1 \ wmp.1 \ wmutils.1 diff --git a/man/wname.1 b/man/wname.1 @@ -1,18 +0,0 @@ -.Dd December 13, 2014 -.Dt WNAME 1 -.Os wmutils -.Sh NAME -.Nm wname -.Nd print window name -.Sh SYNOPSIS -.Nm wname -.Ar wid Op ... -.Sh DESCRIPTION -.Nm -prints the name of the window IDs given as arguments, -one name per line. -.Sh ENVIRONMENT -.Nm -acts on the X display specified by the -.Ev DISPLAY -variable. diff --git a/wname.c b/wname.c @@ -1,65 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#include <stdio.h> -#include <stdlib.h> -#include <xcb/xcb.h> -#include <err.h> - -#include "util.h" - -static xcb_connection_t *conn; - -static void usage(char *); -static int get_title(xcb_window_t); - -static void -usage(char *name) -{ - fprintf(stderr, "usage: %s <wid>\n", name); - exit(1); -} - -static int -get_title(xcb_window_t win) -{ - int len = 0; - xcb_get_property_cookie_t cookie; - xcb_get_property_reply_t *r; - - cookie = xcb_get_property(conn, 0, win, - XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 0L, 32L); - r = xcb_get_property_reply(conn, cookie, NULL); - - if (r) { - len = xcb_get_property_value_length(r); - if (!len) - return 1; - - printf("%.*s\n", len, (char *) xcb_get_property_value(r)); - - free(r); - return 0; - } - - warnx("could not get window title"); - free(r); - return 1; -} - -int -main(int argc, char **argv) -{ - int i, r = 0; - - if (argc < 2) - usage(argv[0]); - - init_xcb(&conn); - - for (i=1; i < argc; i++) - r += get_title(strtoul(argv[i], NULL, 16)); - - kill_xcb(&conn); - - return r; -}