diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2008-06-11 09:34:00 +0100 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2008-06-11 09:34:00 +0100 |
| commit | c56533615f84df801f10dedc4d6ff267e0e8df0a (patch) | |
| tree | 968a54a5ab4bc769fea427dc2036f3f22be38211 | |
| parent | applied anydot's patchset.diff (diff) | |
| download | dwm-c56533615f84df801f10dedc4d6ff267e0e8df0a.tar.gz dwm-c56533615f84df801f10dedc4d6ff267e0e8df0a.zip | |
integrated Peter Hartlich's patch, removed const char *c from union, simplified togglelayout
| -rw-r--r-- | config.def.h | 8 | ||||
| -rw-r--r-- | dwm.c | 27 |
2 files changed, 9 insertions, 26 deletions
diff --git a/config.def.h b/config.def.h index af8f70f..6a6f7be 100644 --- a/config.def.h +++ b/config.def.h | |||
| @@ -10,8 +10,8 @@ | |||
| 10 | #define SELFGCOLOR "#ffffff" | 10 | #define SELFGCOLOR "#ffffff" |
| 11 | static uint borderpx = 1; /* border pixel of windows */ | 11 | static uint borderpx = 1; /* border pixel of windows */ |
| 12 | static uint snap = 32; /* snap pixel */ | 12 | static uint snap = 32; /* snap pixel */ |
| 13 | static Bool showbar = True; /* False means no bar */ | 13 | static Bool showbar = True; /* False means no bar */ |
| 14 | static Bool topbar = True; /* False means bottom bar */ | 14 | static Bool topbar = True; /* False means bottom bar */ |
| 15 | 15 | ||
| 16 | /* tagging */ | 16 | /* tagging */ |
| 17 | static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; | 17 | static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; |
| @@ -42,8 +42,8 @@ static Layout layouts[] = { | |||
| 42 | 42 | ||
| 43 | static Key keys[] = { | 43 | static Key keys[] = { |
| 44 | /* modifier key function argument */ | 44 | /* modifier key function argument */ |
| 45 | { MODKEY, XK_p, spawn, {.c = "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" }}, | 45 | { MODKEY, XK_p, spawn, {.v = (char *[]){"dmenu_run", "-fn", FONT, "-nb", NORMBGCOLOR, "-nf", NORMFGCOLOR, "-sb", SELBGCOLOR, "-sf", SELFGCOLOR, NULL}} }, |
| 46 | { MODKEY|ShiftMask, XK_Return, spawn, {.c = "exec uxterm" }}, | 46 | { MODKEY|ShiftMask, XK_Return, spawn, {.v = (char *[]){"uxterm", NULL}} }, |
| 47 | { MODKEY, XK_b, togglebar, {0}}, | 47 | { MODKEY, XK_b, togglebar, {0}}, |
| 48 | { MODKEY, XK_j, focusstack, {.i = +1 }}, | 48 | { MODKEY, XK_j, focusstack, {.i = +1 }}, |
| 49 | { MODKEY, XK_k, focusstack, {.i = -1 }}, | 49 | { MODKEY, XK_k, focusstack, {.i = -1 }}, |
| @@ -93,11 +93,10 @@ typedef struct { | |||
| 93 | } DC; /* draw context */ | 93 | } DC; /* draw context */ |
| 94 | 94 | ||
| 95 | typedef union { | 95 | typedef union { |
| 96 | const char *c; | ||
| 97 | int i; | 96 | int i; |
| 98 | uint ui; | 97 | uint ui; |
| 99 | float f; | 98 | float f; |
| 100 | void *aux; | 99 | void *v; |
| 101 | } Arg; | 100 | } Arg; |
| 102 | 101 | ||
| 103 | typedef struct { | 102 | typedef struct { |
| @@ -1388,10 +1387,6 @@ setup(void) { | |||
| 1388 | 1387 | ||
| 1389 | void | 1388 | void |
| 1390 | spawn(const Arg *arg) { | 1389 | spawn(const Arg *arg) { |
| 1391 | static char *shell = NULL; | ||
| 1392 | |||
| 1393 | if(!shell && !(shell = getenv("SHELL"))) | ||
| 1394 | shell = "/bin/sh"; | ||
| 1395 | /* The double-fork construct avoids zombie processes and keeps the code | 1390 | /* The double-fork construct avoids zombie processes and keeps the code |
| 1396 | * clean from stupid signal handlers. */ | 1391 | * clean from stupid signal handlers. */ |
| 1397 | if(fork() == 0) { | 1392 | if(fork() == 0) { |
| @@ -1399,8 +1394,8 @@ spawn(const Arg *arg) { | |||
| 1399 | if(dpy) | 1394 | if(dpy) |
| 1400 | close(ConnectionNumber(dpy)); | 1395 | close(ConnectionNumber(dpy)); |
| 1401 | setsid(); | 1396 | setsid(); |
| 1402 | execl(shell, shell, "-c", arg->c, (char *)NULL); | 1397 | execvp(((char **)arg->v)[0], (char **)arg->v); |
| 1403 | fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg->c); | 1398 | fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); |
| 1404 | perror(" failed"); | 1399 | perror(" failed"); |
| 1405 | } | 1400 | } |
| 1406 | exit(0); | 1401 | exit(0); |
| @@ -1481,20 +1476,8 @@ togglefloating(const Arg *arg) { | |||
| 1481 | 1476 | ||
| 1482 | void | 1477 | void |
| 1483 | togglelayout(const Arg *arg) { | 1478 | togglelayout(const Arg *arg) { |
| 1484 | uint i; | 1479 | if(++lt == &layouts[LENGTH(layouts)]) |
| 1485 | 1480 | lt = &layouts[0]; | |
| 1486 | if(!arg->c) { | ||
| 1487 | if(++lt == &layouts[LENGTH(layouts)]) | ||
| 1488 | lt = &layouts[0]; | ||
| 1489 | } | ||
| 1490 | else { | ||
| 1491 | for(i = 0; i < LENGTH(layouts); i++) | ||
| 1492 | if(!strcmp(arg->c, layouts[i].symbol)) | ||
| 1493 | break; | ||
| 1494 | if(i == LENGTH(layouts)) | ||
| 1495 | return; | ||
| 1496 | lt = &layouts[i]; | ||
| 1497 | } | ||
| 1498 | if(sel) | 1481 | if(sel) |
| 1499 | arrange(); | 1482 | arrange(); |
| 1500 | else | 1483 | else |
