-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathchwn.c
More file actions
45 lines (34 loc) · 792 Bytes
/
chwn.c
File metadata and controls
45 lines (34 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* See LICENSE file for copyright and license details. */
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <xcb/xcb.h>
#include "arg.h"
#include "util.h"
static xcb_connection_t *conn;
static void usage(char *);
static void set_title(xcb_connection_t *, xcb_window_t, char *);
static void
usage(char *name)
{
fprintf(stderr, "usage: %s <name> <wid>\n", name);
exit(1);
}
void
set_title(xcb_connection_t *con, xcb_window_t w, char *name)
{
xcb_change_property(con, XCB_PROP_MODE_REPLACE, w, XCB_ATOM_WM_NAME,
XCB_ATOM_STRING, 8, strlen(name), name);
xcb_flush(con);
}
int
main(int argc, char **argv)
{
if (argc != 3)
usage(argv[0]);
init_xcb(&conn);
set_title(conn, strtoul(argv[2], NULL, 16), argv[1]);
kill_xcb(&conn);
return 0;
}