Re: [hackers] Re: [dwm][PATCH] Proper restart function

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Mon, 8 Mar 2021 14:49:53 +0100

On Mon, Mar 08, 2021 at 11:29:12AM +0000, Tolu2 wrote:
> On Saturday, March 6, 2021 4:59 PM toluschr wrote:
>
> > The currently available patch reads /proc/self/exe, which fails when recompiling (Why else would I want to restart dwm?)
> > This patch simply saves the commandline arguments on startup and re-executes them.
> >
> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> > dwm.c | 12 +++++++++++-
> > 1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/dwm.c b/dwm.c
> > index 664c527..9e8160f 100644
> > --- a/dwm.c
> > +++ b/dwm.c
> > _AT_@ -234,6 +234,7 @@ static int xerror(Display *dpy, XErrorEvent *ee);
> > static int xerrordummy(Display *dpy, XErrorEvent *ee);
> > static int xerrorstart(Display *dpy, XErrorEvent *ee);
> > static void zoom(const Arg *arg);
> > +static void restart(const Arg arg);
> > / variables */static const char broken[] = "broken";
> > _AT_@ -268,6 +269,7 @@ static Display *dpy;
> > static Drw *drw;
> > static Monitor *mons, *selmon;
> > static Window root, wmcheckwin;
> > +static char *argv;
> > / configuration, allows nested code to access above variables */#include "config.h"
> > _AT_@ -2127,9 +2129,17 @@ zoom(const Arg *arg)
> > pop(c);
> > }
> >
> > +void
> > +restart(const Arg *arg)
> > +{
> >
> > - execvp(argv[0], argv);
> > +}
> >
> > -
> >
> > int
> > -main(int argc, char *argv[])
> > +main(int argc, char *_argv[])
> > {
> >
> > - argv = _argv;
> > - if (argc == 2 && !strcmp("-v", argv[1]))
> > die("dwm-"VERSION);
> > else if (argc != 1)
> > --
> > 2.30.1
> >
>
> I noticed that it might not have been clear that my intention was to have this included in the mainline. Since there is a quit function, why not also have a restart? It makes edits to the source code much more pleasant.
>

Hi,

I don't think the patch makes much sense. It can be solved by running dwm in
some loop and just exiting or killing dwm for example.

Indeed, patches to hackers_AT_ are intended for upstream as described on:
http://suckless.org/community/

-- 
Kind regards,
Hiltjo
Received on Mon Mar 08 2021 - 14:49:53 CET

This archive was generated by hypermail 2.3.0 : Mon Mar 08 2021 - 15:00:34 CET