From 593e3c3847a721afd3c7d88767037a7b13132a11 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Tue, 31 Jan 2023 08:29:47 -0500 Subject: On the fly restart --- config.def.h | 1 + dwm.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/config.def.h b/config.def.h index 9efa774..aed3eb3 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, XK_r, restart, {0} }, { MODKEY|ShiftMask, XK_q, quit, {0} }, }; diff --git a/dwm.c b/dwm.c index c2bd871..8bcf0da 100644 --- a/dwm.c +++ b/dwm.c @@ -142,6 +142,7 @@ typedef struct { } Rule; /* function declarations */ +static void restart(Arg *arg); static void applyrules(Client *c); static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); static void arrange(Monitor *m); @@ -275,6 +276,14 @@ static Window root, wmcheckwin; struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; /* function implementations */ + +void +restart(const Arg *arg) +{ + char *a[] = {"dwm", NULL}; + execvp(a[0], a); +} + void applyrules(Client *c) { -- cgit v1.2.3