dwm-meillo
changeset 189:523df4a3c1c4
using execl now, argv changed, using cmd and const char defs directly in the KEYS struct
author | arg@10ksloc.org |
---|---|
date | Fri, 04 Aug 2006 12:00:55 +0200 |
parents | 6d580a6e5c36 |
children | 713dcc7d2c42 |
files | config.arg.h config.default.h dwm.h util.c |
diffstat | 4 files changed, 18 insertions(+), 18 deletions(-) [+] |
line diff
1.1 --- a/config.arg.h Fri Aug 04 10:36:22 2006 +0200 1.2 +++ b/config.arg.h Fri Aug 04 12:00:55 2006 +0200 1.3 @@ -17,13 +17,6 @@ 1.4 #define MASTERW 60 /* percent */ 1.5 1.6 #define KEYS \ 1.7 - const char *browse[] = { "firefox", NULL }; \ 1.8 - const char *gimp[] = { "gimp", NULL }; \ 1.9 - const char *term[] = { \ 1.10 - "urxvt", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", \ 1.11 - "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL \ 1.12 - }; \ 1.13 - const char *xlock[] = { "xlock", NULL }; \ 1.14 static Key key[] = { \ 1.15 /* modifier key function arguments */ \ 1.16 { MODKEY, XK_0, view, { .i = 0 } }, \ 1.17 @@ -50,10 +43,12 @@ 1.18 { MODKEY|ShiftMask, XK_4, replacetag, { .i = 5 } }, \ 1.19 { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ 1.20 { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ 1.21 - { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, \ 1.22 - { MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } }, \ 1.23 - { MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } }, \ 1.24 - { MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } }, \ 1.25 + { MODKEY|ShiftMask, XK_x, spawn, \ 1.26 + { .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" \ 1.27 + " awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, \ 1.28 + { MODKEY|ShiftMask, XK_Return, spawn, \ 1.29 + { .cmd = "exec urxvt -tr +sb -bg black -fg white -cr white " \ 1.30 + "-fn '-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*'" } }, \ 1.31 }; 1.32 1.33 #define RULES \
2.1 --- a/config.default.h Fri Aug 04 10:36:22 2006 +0200 2.2 +++ b/config.default.h Fri Aug 04 12:00:55 2006 +0200 2.3 @@ -17,7 +17,6 @@ 2.4 #define MASTERW 60 /* percent */ 2.5 2.6 #define KEYS \ 2.7 - const char *term[] = { "xterm", NULL }; \ 2.8 static Key key[] = { \ 2.9 /* modifier key function arguments */ \ 2.10 { MODKEY, XK_0, view, { .i = 0 } }, \ 2.11 @@ -44,7 +43,10 @@ 2.12 { MODKEY|ShiftMask, XK_4, replacetag, { .i = 4 } }, \ 2.13 { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ 2.14 { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ 2.15 - { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, \ 2.16 + /* { MODKEY|ShiftMask, XK_x, spawn, */ \ 2.17 + /* { .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" */ \ 2.18 + /* " awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, */ \ 2.19 + { MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \ 2.20 }; 2.21 2.22 #define RULES \
3.1 --- a/dwm.h Fri Aug 04 10:36:22 2006 +0200 3.2 +++ b/dwm.h Fri Aug 04 12:00:55 2006 +0200 3.3 @@ -17,7 +17,7 @@ 3.4 typedef struct Fnt Fnt; 3.5 3.6 union Arg { 3.7 - const char **argv; 3.8 + const char *cmd; 3.9 int i; 3.10 }; 3.11
4.1 --- a/util.c Fri Aug 04 10:36:22 2006 +0200 4.2 +++ b/util.c Fri Aug 04 12:00:55 2006 +0200 4.3 @@ -43,17 +43,20 @@ 4.4 void 4.5 spawn(Arg *arg) 4.6 { 4.7 - char **argv = (char **)arg->argv; 4.8 + static char *shell = NULL; 4.9 4.10 - if(!argv || !argv[0]) 4.11 + if(!shell && !(shell = getenv("SHELL"))) 4.12 + shell = "/bin/sh"; 4.13 + 4.14 + if(!arg->cmd) 4.15 return; 4.16 if(fork() == 0) { 4.17 if(fork() == 0) { 4.18 if(dpy) 4.19 close(ConnectionNumber(dpy)); 4.20 setsid(); 4.21 - execvp(argv[0], argv); 4.22 - fprintf(stderr, "dwm: execvp %s", argv[0]); 4.23 + execl(shell, shell, "-c", arg->cmd, NULL); 4.24 + fprintf(stderr, "dwm: execl '%s'", arg->cmd); 4.25 perror(" failed"); 4.26 } 4.27 exit(0);