From 44747a17e506c186e7ca8f30e78064c5ec776160 Mon Sep 17 00:00:00 2001
From: Friedel Schon <derfriedmundschoen@gmail.com>
Date: Tue, 20 Feb 2024 12:05:38 +0100
Subject: [PATCH] refresh

---
 config.def.h | 1 +
 dwm.c        | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/config.def.h b/config.def.h
index 9efa774..d6d78c4 100644
--- a/config.def.h
+++ b/config.def.h
@@ -94,6 +94,7 @@ static const Key keys[] = {
 	TAGKEYS(                        XK_7,                      6)
 	TAGKEYS(                        XK_8,                      7)
 	TAGKEYS(                        XK_9,                      8)
+	{ MODKEY|ShiftMask, 			XL_r, 	   refresh, 	   {0} },
 	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
 };
 
diff --git a/dwm.c b/dwm.c
index f1d86b2..7454d47 100644
--- a/dwm.c
+++ b/dwm.c
@@ -188,6 +188,7 @@ static Client *nexttiled(Client *c);
 static void pop(Client *c);
 static void propertynotify(XEvent *e);
 static void quit(const Arg *arg);
+static void refresh(const Arg *arg);
 static Monitor *recttomon(int x, int y, int w, int h);
 static void resize(Client *c, int x, int y, int w, int h, int interact);
 static void resizeclient(Client *c, int x, int y, int w, int h);
@@ -267,6 +268,7 @@ static Display *dpy;
 static Drw *drw;
 static Monitor *mons, *selmon;
 static Window root, wmcheckwin;
+static char* selfarg;
 
 /* configuration, allows nested code to access above variables */
 #include "config.h"
@@ -1261,6 +1263,12 @@ quit(const Arg *arg)
 	running = 0;
 }
 
+void
+refresh(const Arg *arg) {
+	execl(selfarg, selfarg, NULL);
+	perror("self-execl");
+}
+
 Monitor *
 recttomon(int x, int y, int w, int h)
 {
@@ -2143,6 +2151,7 @@ zoom(const Arg *arg)
 int
 main(int argc, char *argv[])
 {
+	selfarg = argv[0];
 	if (argc == 2 && !strcmp("-v", argv[1]))
 		die("dwm-"VERSION);
 	else if (argc != 1)
-- 
2.43.0

