commit cd3b00c38e589e30246b02fd0913853951ce4f0b
parent 0e08f0e8332c86dd898aeb88e80febde9de2a3ea
Author: siduck76 <siduckk76@protonmail.com>
Date: Sun, 24 Jan 2021 13:32:25 +0530
live-reload patch
Diffstat:
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/x.c b/x.c
@@ -2155,6 +2155,28 @@ usage(void)
" [stty_args ...]\n", argv0, argv0);
}
+void
+reload(int sig)
+{
+ config_init();
+
+ /* colors, fonts */
+ xloadcols();
+ xunloadfonts();
+ usedfont = (opt_font == NULL)? font : opt_font;
+ xloadfonts(usedfont, 0);
+
+ /* pretend the window just got resized */
+ cresize(win.w, win.h);
+
+ redraw();
+
+ /* triggers re-render if we're visible. */
+ ttywrite("\033[O", 3, 1);
+
+ signal(SIGUSR1, reload);
+}
+
int
main(int argc, char *argv[])
{
@@ -2225,6 +2247,7 @@ run:
config_init();
cols = MAX(cols, 1);
rows = MAX(rows, 1);
+ signal(SIGUSR1, reload);
tnew(cols, rows);
xinit(cols, rows);
xsetenv();
diff --git a/x.c.orig b/x.c.orig
@@ -695,7 +695,7 @@ brelease(XEvent *e)
return;
}
- if (e->xbutton.button == Button2)
+ if (e->xbutton.button == Button3)
selpaste(NULL);
else if (e->xbutton.button == Button1)
mousesel(e, 1);