mirror of git://git.suckless.org/dwm
using execl now, argv changed, using cmd and const char defs directly in the KEYS struct
This commit is contained in:
parent
0dfe729f90
commit
9955ddc978
17
config.arg.h
17
config.arg.h
|
@ -17,13 +17,6 @@ const char *tags[] = { "fnord", "dev", "net", "work", "misc", NULL };
|
||||||
#define MASTERW 60 /* percent */
|
#define MASTERW 60 /* percent */
|
||||||
|
|
||||||
#define KEYS \
|
#define KEYS \
|
||||||
const char *browse[] = { "firefox", NULL }; \
|
|
||||||
const char *gimp[] = { "gimp", NULL }; \
|
|
||||||
const char *term[] = { \
|
|
||||||
"urxvt", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", \
|
|
||||||
"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL \
|
|
||||||
}; \
|
|
||||||
const char *xlock[] = { "xlock", NULL }; \
|
|
||||||
static Key key[] = { \
|
static Key key[] = { \
|
||||||
/* modifier key function arguments */ \
|
/* modifier key function arguments */ \
|
||||||
{ MODKEY, XK_0, view, { .i = 0 } }, \
|
{ MODKEY, XK_0, view, { .i = 0 } }, \
|
||||||
|
@ -50,10 +43,12 @@ static Key key[] = { \
|
||||||
{ MODKEY|ShiftMask, XK_4, replacetag, { .i = 5 } }, \
|
{ MODKEY|ShiftMask, XK_4, replacetag, { .i = 5 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
|
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
|
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, \
|
{ MODKEY|ShiftMask, XK_x, spawn, \
|
||||||
{ MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } }, \
|
{ .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" \
|
||||||
{ MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } }, \
|
" awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, \
|
||||||
{ MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } }, \
|
{ MODKEY|ShiftMask, XK_Return, spawn, \
|
||||||
|
{ .cmd = "exec urxvt -tr +sb -bg black -fg white -cr white " \
|
||||||
|
"-fn '-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*'" } }, \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RULES \
|
#define RULES \
|
||||||
|
|
|
@ -17,7 +17,6 @@ const char *tags[] = { "0", "1", "2", "3", "4", NULL };
|
||||||
#define MASTERW 60 /* percent */
|
#define MASTERW 60 /* percent */
|
||||||
|
|
||||||
#define KEYS \
|
#define KEYS \
|
||||||
const char *term[] = { "xterm", NULL }; \
|
|
||||||
static Key key[] = { \
|
static Key key[] = { \
|
||||||
/* modifier key function arguments */ \
|
/* modifier key function arguments */ \
|
||||||
{ MODKEY, XK_0, view, { .i = 0 } }, \
|
{ MODKEY, XK_0, view, { .i = 0 } }, \
|
||||||
|
@ -44,7 +43,10 @@ static Key key[] = { \
|
||||||
{ MODKEY|ShiftMask, XK_4, replacetag, { .i = 4 } }, \
|
{ MODKEY|ShiftMask, XK_4, replacetag, { .i = 4 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
|
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
|
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, \
|
/* { MODKEY|ShiftMask, XK_x, spawn, */ \
|
||||||
|
/* { .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" */ \
|
||||||
|
/* " awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, */ \
|
||||||
|
{ MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RULES \
|
#define RULES \
|
||||||
|
|
2
dwm.h
2
dwm.h
|
@ -17,7 +17,7 @@ typedef struct DC DC;
|
||||||
typedef struct Fnt Fnt;
|
typedef struct Fnt Fnt;
|
||||||
|
|
||||||
union Arg {
|
union Arg {
|
||||||
const char **argv;
|
const char *cmd;
|
||||||
int i;
|
int i;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
11
util.c
11
util.c
|
@ -43,17 +43,20 @@ eprint(const char *errstr, ...)
|
||||||
void
|
void
|
||||||
spawn(Arg *arg)
|
spawn(Arg *arg)
|
||||||
{
|
{
|
||||||
char **argv = (char **)arg->argv;
|
static char *shell = NULL;
|
||||||
|
|
||||||
if(!argv || !argv[0])
|
if(!shell && !(shell = getenv("SHELL")))
|
||||||
|
shell = "/bin/sh";
|
||||||
|
|
||||||
|
if(!arg->cmd)
|
||||||
return;
|
return;
|
||||||
if(fork() == 0) {
|
if(fork() == 0) {
|
||||||
if(fork() == 0) {
|
if(fork() == 0) {
|
||||||
if(dpy)
|
if(dpy)
|
||||||
close(ConnectionNumber(dpy));
|
close(ConnectionNumber(dpy));
|
||||||
setsid();
|
setsid();
|
||||||
execvp(argv[0], argv);
|
execl(shell, shell, "-c", arg->cmd, NULL);
|
||||||
fprintf(stderr, "dwm: execvp %s", argv[0]);
|
fprintf(stderr, "dwm: execl '%s'", arg->cmd);
|
||||||
perror(" failed");
|
perror(" failed");
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
Loading…
Reference in New Issue