mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-03-22 08:51:31 +00:00
Compare commits
2 Commits
cca388a012
...
f8d1cfad11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8d1cfad11 | ||
|
|
0ddfff3376 |
@ -5,9 +5,8 @@ Note: Commands from array are executed using execvp(). So if you need to execute
|
|||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [git branch](https://codeberg.org/sevz/dwl/src/branch/autostart)
|
- [git branch](https://codeberg.org/sevz/dwl/src/branch/autostart)
|
||||||
- [wlroots-next-f4249db](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-wlroots-next-f4249db.patch)
|
- [autostart-wlroots-next-f4249db.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-wlroots-next-f4249db.patch)
|
||||||
- [0.8](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-0.8.patch)
|
- [autostart-0.8.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-0.8.patch)
|
||||||
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-0.7.patch)
|
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [fauxmight](https://codeberg.org/fauxmight)
|
- [fauxmight](https://codeberg.org/fauxmight)
|
||||||
|
|||||||
@ -1,154 +0,0 @@
|
|||||||
From 787f7252d63945996f009828aff3c44afd0f7781 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
|
||||||
<leohdz172@proton.me>
|
|
||||||
Date: Sat, 8 Jul 2023 17:11:36 -0600
|
|
||||||
Subject: [PATCH] port autostart patch from dwm
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
https://dwm.suckless.org/patches/cool_autostart/
|
|
||||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
|
||||||
---
|
|
||||||
config.def.h | 7 +++++++
|
|
||||||
dwl.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++-----
|
|
||||||
2 files changed, 61 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 22d2171..8dc6502 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
|
||||||
/* logging */
|
|
||||||
static int log_level = WLR_ERROR;
|
|
||||||
|
|
||||||
+/* Autostart */
|
|
||||||
+static const char *const autostart[] = {
|
|
||||||
+ "wbg", "/path/to/your/image", NULL,
|
|
||||||
+ NULL /* terminate */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+
|
|
||||||
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
|
||||||
static const Rule rules[] = {
|
|
||||||
/* app_id title tags mask isfloating monitor */
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index 5bf995e..e8b8727 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -249,6 +249,7 @@ static void arrange(Monitor *m);
|
|
||||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
|
||||||
struct wlr_box *usable_area, int exclusive);
|
|
||||||
static void arrangelayers(Monitor *m);
|
|
||||||
+static void autostartexec(void);
|
|
||||||
static void axisnotify(struct wl_listener *listener, void *data);
|
|
||||||
static void buttonpress(struct wl_listener *listener, void *data);
|
|
||||||
static void chvt(const Arg *arg);
|
|
||||||
@@ -432,6 +433,9 @@ static xcb_atom_t netatom[NetLast];
|
|
||||||
/* attempt to encapsulate suck into one file */
|
|
||||||
#include "client.h"
|
|
||||||
|
|
||||||
+static pid_t *autostart_pids;
|
|
||||||
+static size_t autostart_len;
|
|
||||||
+
|
|
||||||
/* function implementations */
|
|
||||||
void
|
|
||||||
applybounds(Client *c, struct wlr_box *bbox)
|
|
||||||
@@ -580,6 +584,27 @@ arrangelayers(Monitor *m)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+autostartexec(void) {
|
|
||||||
+ const char *const *p;
|
|
||||||
+ size_t i = 0;
|
|
||||||
+
|
|
||||||
+ /* count entries */
|
|
||||||
+ for (p = autostart; *p; autostart_len++, p++)
|
|
||||||
+ while (*++p);
|
|
||||||
+
|
|
||||||
+ autostart_pids = calloc(autostart_len, sizeof(pid_t));
|
|
||||||
+ for (p = autostart; *p; i++, p++) {
|
|
||||||
+ if ((autostart_pids[i] = fork()) == 0) {
|
|
||||||
+ setsid();
|
|
||||||
+ execvp(*p, (char *const *)p);
|
|
||||||
+ die("dwl: execvp %s:", *p);
|
|
||||||
+ }
|
|
||||||
+ /* skip arguments */
|
|
||||||
+ while (*++p);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
axisnotify(struct wl_listener *listener, void *data)
|
|
||||||
{
|
|
||||||
@@ -676,11 +701,21 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
|
||||||
void
|
|
||||||
cleanup(void)
|
|
||||||
{
|
|
||||||
+ size_t i;
|
|
||||||
#ifdef XWAYLAND
|
|
||||||
wlr_xwayland_destroy(xwayland);
|
|
||||||
xwayland = NULL;
|
|
||||||
#endif
|
|
||||||
wl_display_destroy_clients(dpy);
|
|
||||||
+
|
|
||||||
+ /* kill child processes */
|
|
||||||
+ for (i = 0; i < autostart_len; i++) {
|
|
||||||
+ if (0 < autostart_pids[i]) {
|
|
||||||
+ kill(autostart_pids[i], SIGTERM);
|
|
||||||
+ waitpid(autostart_pids[i], NULL, 0);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (child_pid > 0) {
|
|
||||||
kill(-child_pid, SIGTERM);
|
|
||||||
waitpid(child_pid, NULL, 0);
|
|
||||||
@@ -1497,18 +1532,31 @@ void
|
|
||||||
handlesig(int signo)
|
|
||||||
{
|
|
||||||
if (signo == SIGCHLD) {
|
|
||||||
-#ifdef XWAYLAND
|
|
||||||
siginfo_t in;
|
|
||||||
/* wlroots expects to reap the XWayland process itself, so we
|
|
||||||
* use WNOWAIT to keep the child waitable until we know it's not
|
|
||||||
* XWayland.
|
|
||||||
*/
|
|
||||||
while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
|
|
||||||
- && (!xwayland || in.si_pid != xwayland->server->pid))
|
|
||||||
- waitpid(in.si_pid, NULL, 0);
|
|
||||||
-#else
|
|
||||||
- while (waitpid(-1, NULL, WNOHANG) > 0);
|
|
||||||
+#ifdef XWAYLAND
|
|
||||||
+ && (!xwayland || in.si_pid != xwayland->server->pid)
|
|
||||||
#endif
|
|
||||||
+ ) {
|
|
||||||
+ pid_t *p, *lim;
|
|
||||||
+ waitpid(in.si_pid, NULL, 0);
|
|
||||||
+ if (in.si_pid == child_pid)
|
|
||||||
+ child_pid = -1;
|
|
||||||
+ if (!(p = autostart_pids))
|
|
||||||
+ continue;
|
|
||||||
+ lim = &p[autostart_len];
|
|
||||||
+
|
|
||||||
+ for (; p < lim; p++) {
|
|
||||||
+ if (*p == in.si_pid) {
|
|
||||||
+ *p = -1;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
} else if (signo == SIGINT || signo == SIGTERM) {
|
|
||||||
quit(NULL);
|
|
||||||
}
|
|
||||||
@@ -2224,6 +2272,7 @@ run(char *startup_cmd)
|
|
||||||
die("startup: backend_start");
|
|
||||||
|
|
||||||
/* Now that the socket exists and the backend is started, run the startup command */
|
|
||||||
+ autostartexec();
|
|
||||||
if (startup_cmd) {
|
|
||||||
int piperw[2];
|
|
||||||
if (pipe(piperw) < 0)
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
From aa7e36e6dfe3c08f13339e571ad886cf51c76708 Mon Sep 17 00:00:00 2001
|
From d2e2e61aeb25ad71c2c559994968ba64e0974503 Mon Sep 17 00:00:00 2001
|
||||||
From: A Frederick Christensen <dwl@ivories.org>
|
From: A Frederick Christensen <dwl@ivories.org>
|
||||||
Date: Sun, 22 Feb 2026 19:23:48 -0600
|
Date: Fri, 27 Feb 2026 12:23:04 -0600
|
||||||
Subject: [PATCH] port autostart patch from dwm
|
Subject: [PATCH] Applied autostart patch
|
||||||
|
|
||||||
---
|
---
|
||||||
config.def.h | 6 ++++++
|
config.def.h | 6 ++++++
|
||||||
@ -26,7 +26,7 @@ index 8a6eda0..6eb0db4 100644
|
|||||||
/* app_id title tags mask isfloating monitor */
|
/* app_id title tags mask isfloating monitor */
|
||||||
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 44f3ad9..c7b717d 100644
|
index 44f3ad9..e7b6199 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -246,6 +246,7 @@ static void arrange(Monitor *m);
|
@@ -246,6 +246,7 @@ static void arrange(Monitor *m);
|
||||||
@ -37,16 +37,16 @@ index 44f3ad9..c7b717d 100644
|
|||||||
static void axisnotify(struct wl_listener *listener, void *data);
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
static void buttonpress(struct wl_listener *listener, void *data);
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
static void chvt(const Arg *arg);
|
static void chvt(const Arg *arg);
|
||||||
@@ -455,6 +456,9 @@ static struct wlr_xwayland *xwayland;
|
@@ -449,6 +450,9 @@ static struct wl_listener xwayland_ready = {.notify = xwaylandready};
|
||||||
/* attempt to encapsulate suck into one file */
|
static struct wlr_xwayland *xwayland;
|
||||||
#include "client.h"
|
#endif
|
||||||
|
|
||||||
+static pid_t *autostart_pids;
|
+static pid_t *autostart_pids;
|
||||||
+static size_t autostart_len;
|
+static size_t autostart_len;
|
||||||
+
|
+
|
||||||
/* function implementations */
|
/* configuration, allows nested code to access above variables */
|
||||||
void
|
#include "config.h"
|
||||||
applybounds(Client *c, struct wlr_box *bbox)
|
|
||||||
@@ -603,6 +607,27 @@ arrangelayers(Monitor *m)
|
@@ -603,6 +607,27 @@ arrangelayers(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From c4970eb320557aa55fde5f831677cc2f6d1f626a Mon Sep 17 00:00:00 2001
|
From e8932f159793012a54047c48b3710703a63c07fb Mon Sep 17 00:00:00 2001
|
||||||
From: A Frederick Christensen <dwl@ivories.org>
|
From: A Frederick Christensen <dwl@ivories.org>
|
||||||
Date: Sun, 22 Feb 2026 19:34:11 -0600
|
Date: Fri, 27 Feb 2026 12:29:02 -0600
|
||||||
Subject: [PATCH] Apply autostart patch
|
Subject: [PATCH] Applied autostart patch
|
||||||
|
|
||||||
---
|
---
|
||||||
config.def.h | 6 ++++++
|
config.def.h | 6 ++++++
|
||||||
@ -26,7 +26,7 @@ index 8a6eda0..6eb0db4 100644
|
|||||||
/* app_id title tags mask isfloating monitor */
|
/* app_id title tags mask isfloating monitor */
|
||||||
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
diff --git a/dwl.c b/dwl.c
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 8a9715d..5da86c6 100644
|
index 8a9715d..3450817 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -248,6 +248,7 @@ static void arrange(Monitor *m);
|
@@ -248,6 +248,7 @@ static void arrange(Monitor *m);
|
||||||
@ -37,16 +37,16 @@ index 8a9715d..5da86c6 100644
|
|||||||
static void axisnotify(struct wl_listener *listener, void *data);
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
static void buttonpress(struct wl_listener *listener, void *data);
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
static void chvt(const Arg *arg);
|
static void chvt(const Arg *arg);
|
||||||
@@ -457,6 +458,9 @@ static struct wlr_xwayland *xwayland;
|
@@ -451,6 +452,9 @@ static struct wl_listener xwayland_ready = {.notify = xwaylandready};
|
||||||
/* attempt to encapsulate suck into one file */
|
static struct wlr_xwayland *xwayland;
|
||||||
#include "client.h"
|
#endif
|
||||||
|
|
||||||
+static pid_t *autostart_pids;
|
+static pid_t *autostart_pids;
|
||||||
+static size_t autostart_len;
|
+static size_t autostart_len;
|
||||||
+
|
+
|
||||||
/* function implementations */
|
/* configuration, allows nested code to access above variables */
|
||||||
void
|
#include "config.h"
|
||||||
applybounds(Client *c, struct wlr_box *bbox)
|
|
||||||
@@ -605,6 +609,27 @@ arrangelayers(Monitor *m)
|
@@ -605,6 +609,27 @@ arrangelayers(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user