commit 7ffde47
ohmu
·
2026-07-17 21:45:20 +0300 MSK
parent d80acaf
added wtp analog which will be instead of wmv and wrs too
3 files changed,
+48,
-6
M
TODO
+0,
-3
1@@ -3,10 +3,7 @@ chwb
2 chwso
3 mapw
4 wmp
5-wmv
6-wrs
7 wtf
8-wtp
9
10 opt:
11 chwb2
+3,
-3
1@@ -1,10 +1,10 @@
2 CC = clang
3 CFLAGS = -O2 -pipe -std=c99 -D_POSIX_C_SOURCE=200809L
4-LDFLAGS = -lxcb
5+LDFLAGS = -lxcb -lxcb-util
6 PREFIX = /usr/local
7
8-BIN = wa fw lw ra
9-SRC = wa.c fw.c lw.c ra.c
10+BIN = wa fw lw ra wt
11+SRC = wa.c fw.c lw.c ra.c wt.c
12
13 all: $(BIN)
14
+45,
-0
1@@ -0,0 +1,45 @@
2+// window teleport
3+// can be used as a resizer/mover in scripts
4+
5+#include <xcb/xcb.h>
6+#include <xcb/xcb_aux.h>
7+#include <stdlib.h>
8+#include <stdio.h>
9+#include <inttypes.h>
10+
11+xcb_connection_t *connection;
12+
13+void
14+teleport_window(xcb_window_t window, int x, int y, int w, int h)
15+{
16+ uint32_t properties[4] = { x, y, w, h };
17+ uint32_t mask = XCB_CONFIG_WINDOW_X
18+ | XCB_CONFIG_WINDOW_Y
19+ | XCB_CONFIG_WINDOW_WIDTH
20+ | XCB_CONFIG_WINDOW_HEIGHT;
21+ xcb_configure_window(connection, window, mask, properties);
22+}
23+
24+int
25+main(int argc, char *argv[])
26+{
27+ xcb_window_t window;
28+
29+ if (argc != 6) {
30+ fprintf(stderr, "usage: %s x y w h wid\n", argv[0]);
31+ exit(1);
32+ }
33+ connection = xcb_connect(NULL,NULL);
34+
35+ window = strtoul(argv[5], NULL, 16);
36+ if (!window) {
37+ fprintf(stderr, "can't find window\n");
38+ exit(1);
39+ }
40+
41+ teleport_window(window, atoi(argv[1]), atoi(argv[2]),
42+ atoi(argv[3]), atoi(argv[4]));
43+ xcb_aux_sync(connection);
44+ xcb_disconnect(connection);
45+ return 0;
46+}