update notice and improve stability for hot-reload patch

This commit is contained in:
Sivecano
2025-02-18 13:32:33 +01:00
parent 7d0de9d9a8
commit 27b00008cb
3 changed files with 63 additions and 51 deletions
+11 -9
View File
@@ -1,4 +1,4 @@
From 4b20c81709895564fa623e8752d6cf8e9ec0f98e Mon Sep 17 00:00:00 2001
From 5d74e3775b9ffc96b22910f62b4bb3892f6d96cf Mon Sep 17 00:00:00 2001
From: Sivecano <sivecano@gmail.com>
Date: Sun, 26 Jan 2025 18:30:02 +0100
Subject: [PATCH] redo hot-reloading in one file
@@ -6,10 +6,10 @@ Subject: [PATCH] redo hot-reloading in one file
---
Makefile | 18 ++-
config.def.h | 5 +-
dwl.c | 335 ++++++++++++++++++++++++++++++++++++++++++++-------
dwl.c | 337 ++++++++++++++++++++++++++++++++++++++++++++-------
util.c | 34 ++++++
util.h | 6 +
5 files changed, 349 insertions(+), 49 deletions(-)
5 files changed, 351 insertions(+), 49 deletions(-)
diff --git a/Makefile b/Makefile
index 3358bae..9cf200f 100644
@@ -93,7 +93,7 @@ index 22d2171..6e3dda1 100644
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
diff --git a/dwl.c b/dwl.c
index def2562..6a428c5 100644
index def2562..7e059ad 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1,6 +1,15 @@
@@ -552,7 +552,7 @@ index def2562..6a428c5 100644
}
xcb_atom_t
@@ -3185,17 +3310,139 @@ xwaylandready(struct wl_listener *listener, void *data)
@@ -3185,17 +3310,141 @@ xwaylandready(struct wl_listener *listener, void *data)
}
#endif
@@ -613,7 +613,6 @@ index def2562..6a428c5 100644
+ char tmp[PATH_MAX];
+ printf("checking path: %s\n", paths[i]);
+ strcpy(tmp, paths[i]);
+ // printf("tmp: %s\n", tmp);
+ strcat(tmp, "/dwl.so");
+ if (access(tmp, F_OK|R_OK) == 0)
+ {
@@ -645,7 +644,9 @@ index def2562..6a428c5 100644
+ if (new == NULL)
+ {
+ wlr_log(WLR_ERROR, "couldn't load new dwl module from %s", get_module_path());
+ system("notify-send -u low \"failed to reload dwl\"");
+
+ if (fork() == 0)
+ execl("/bin/env", "--", "Notify-send", "-u", "low", "failed to reload dwl", NULL);
+ return;
+ }
+
@@ -671,7 +672,8 @@ index def2562..6a428c5 100644
+ last_module = dwl_module;
+ dwl_module = new;
+
+ system("notify-send -u low \"reloaded dwl\"");
+ if (fork() == 0)
+ execl("/bin/env", "--", "notify-send", "-u", "low", "reloaded dwl", NULL);
+
+}
+
@@ -693,7 +695,7 @@ index def2562..6a428c5 100644
else if (c == 'v')
die("dwl " VERSION);
else
@@ -3215,3 +3462,5 @@ main(int argc, char *argv[])
@@ -3215,3 +3464,5 @@ main(int argc, char *argv[])
usage:
die("Usage: %s [-v] [-d] [-s startup command]", argv[0]);
}