diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-28 22:45:14 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-28 22:45:14 +0530 |
commit | 5502a9888d0ef4852e36bcec63be8dc80ec3f81c (patch) | |
tree | aa1548cf6a48190a8dc952e281da2fec9452b773 | |
parent | c7b8d52caa330f3fabbe7342d754c2235b8616c2 (diff) |
Reapply "regions patch"
This reverts commit 3b6273bc54cda38318180c641a90d105c4e860ef.
-rw-r--r-- | dwl.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -376,6 +376,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; @@ -3400,6 +3401,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) |