Re: [dev] dwm and -geometry

From: Eckehard Berns <>
Date: Tue, 6 Oct 2009 19:03:55 +0200

> BTW, why do you think that it should be set once in config.h
> which applications should start in floating mode?

You don't have to do that for every application. If there is some
misbehaving application I use only so often, I tend to activate
floating mode (mod+f), start the application, make it floating
(mod+shift+space) and go back to tiling mode (mod+t). But for
applications I'm using more frequently editing config.h and recompiling
dwm might be worth it.

> If the policy of the Developers is that dwm should be configured through
> config.h (I am not arguing agains that) can one restart dwm on the fly
> after recompiling it?

I too found it cumbersome to quit the whole X session just to try out
a config setting for dwm (or upgrading it).

I added this line to config.h:

        { MODKEY|ShiftMask, XK_r, restart, {0} },

and used the following patch to make dwm restart by pressing

It's not perfect, because dwm will not remeber which window has which
tags or which tags you're currently viewing, but that wasn't my main

--- dwm.orig/dwm.c
+++ dwm/dwm.c
@@ -238,6 +238,7 @@ static int xerror(Display *dpy, XErrorEv
 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";
@@ -264,6 +265,7 @@ static void (*handler[LASTEvent]) (XEven
 static Atom wmatom[WMLast], netatom[NetLast];
 static Bool otherwm;
 static Bool running = True;
+static Bool do_restart = False;
 static Cursor cursor[CurLast];
 static Display *dpy;
 static DC dc;
@@ -1999,6 +2001,12 @@ zoom(const Arg *arg) {
+restart(const Arg *arg) {
+ do_restart = 1;
+ running = 0;
 main(int argc, char *argv[]) {
         if(argc == 2 && !strcmp("-v", argv[1]))
@@ -2015,5 +2023,7 @@ main(int argc, char *argv[]) {
+ if (do_restart)
+ execlp(argv[0], argv[0], NULL);
         return 0;

Eckehard Berns
Received on Tue Oct 06 2009 - 17:03:55 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 06 2009 - 17:12:02 UTC