mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-26 17:54:17 +00:00
re-introduce regions patch
This commit is contained in:
parent
1d119cc85c
commit
dc57f8e43f
@ -1,10 +0,0 @@
|
|||||||
### Description
|
|
||||||
This patch will allow for a program to be used and have the current window regions on all monitors to be passed to the program as standard input.
|
|
||||||
|
|
||||||
example is `grim -g "$(slurp)"`
|
|
||||||
|
|
||||||
### Download
|
|
||||||
- [2023-07-23](https://github.com/djpohly/dwl/compare/main...apprehensions:dwl:regions.patch)
|
|
||||||
|
|
||||||
### Authors
|
|
||||||
- [sewn](https://github.com/apprehensions)
|
|
||||||
71
regions/regions.patch
Normal file
71
regions/regions.patch
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
From 9991f8bbf2e379dfca8eb356c03d3d20085255a8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: sewn <sewn@disroot.org>
|
||||||
|
Date: Sun, 23 Jul 2023 08:13:52 +0300
|
||||||
|
Subject: [PATCH] pass window regions to given program as stdin
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 1 +
|
||||||
|
dwl.c | 28 ++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 29 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 9009517..79d0236 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -122,6 +122,7 @@ static const Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||||
|
+ { MODKEY, XKB_KEY_r, regions, SHCMD("grim -g \"$(slurp)\"") },
|
||||||
|
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||||
|
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||||
|
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||||
|
diff --git a/dwl.c b/dwl.c
|
||||||
|
index fa76db2..9588e36 100644
|
||||||
|
--- a/dwl.c
|
||||||
|
+++ b/dwl.c
|
||||||
|
@@ -334,6 +334,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 const char broken[] = "broken";
|
||||||
|
@@ -2823,6 +2824,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)
|
||||||
|
--
|
||||||
|
2.43.1
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user