summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornic <ra@afu.re>2025-08-02 14:40:23 -0400
committernic <ra@afu.re>2025-08-02 14:40:23 -0400
commit9870fdef2ab67089ede2736f1ed9cb0c5480fe21 (patch)
tree71d6094c00a457787cdf3dd1cd71850136bae263
parent1b5a5597a53da67dacd5ef6f83d73ffccad283f3 (diff)
region.patch 2024-02-14 applied
-rw-r--r--dwl.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index 8317132..059aeeb 100644
--- a/dwl.c
+++ b/dwl.c
@@ -401,6 +401,7 @@ static Monitor *xytomon(double x, double y);
static void xytonode(double x, double y, struct wlr_surface **psurface,
Client **pc, LayerSurface **pl, double *nx, double *ny);
static void zoom(const Arg *arg);
+static void regions(const Arg *arg);
/* variables */
static pid_t child_pid = -1;
@@ -3601,6 +3602,33 @@ zoom(const Arg *arg)
arrange(selmon);
}
+void
+regions(const Arg *arg)
+{
+ int pipefd[2];
+ Client *c;
+ Monitor *m;
+
+ if (pipe(pipefd) == -1)
+ return;
+ if (fork() == 0) {
+ close(pipefd[1]);
+ dup2(pipefd[0], STDIN_FILENO);
+ close(pipefd[0]);
+ setsid();
+ execvp(((char **)arg->v)[0], (char **)arg->v);
+ die("dwl: execvp %s failed:", ((char **)arg->v)[0]);
+ }
+
+ close(pipefd[0]);
+ wl_list_for_each(m, &mons, link)
+ wl_list_for_each(c, &clients, link)
+ if (VISIBLEON(c, m))
+ dprintf(pipefd[1], "%d,%d %dx%d\n",
+ c->geom.x, c->geom.y, c->geom.width, c->geom.height);
+ close(pipefd[1]);
+}
+
#ifdef XWAYLAND
void
activatex11(struct wl_listener *listener, void *data)