wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit fd181a0a7edbfc217fad31dd2a6ec7ce3b8dd971
parent e017e86e492ea88de544cd9c02e7e1abf72d6f3f
Author: Kris Maglione <jg@suckless.org>
Date:   Thu, 15 Mar 2007 17:36:21 -0400

Added an exec command to /ctl

Diffstat:
fs.c | 4++++
main.c | 5+++++
wmii.h | 1+
3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/fs.c b/fs.c @@ -236,6 +236,10 @@ message_root(char *message) } if(!strcmp(message, "quit ")) srv.running = 0; + else if(!strncmp(message, "exec ", 5)) { + srv.running = 0; + execstr = strdup(&message[5]); + } else if(!strncmp(message, "view ", 5)) select_view(&message[5]); else if(!strncmp(message, "selcolors ", 10)) { diff --git a/main.c b/main.c @@ -23,6 +23,7 @@ static Bool check_other_wm; static int (*x_error_handler) (Display *, XErrorEvent *); static char version[] = "wmiiwm - " VERSION ", (C)opyright MMVI-MMVII Kris Maglione\n"; static struct sigaction sa; +static int sleeperfd; static void usage() { @@ -217,6 +218,7 @@ init_traps() { fatal("Can't fork(): %s\n", strerror(errno)); default: close(fd[0]); + sleeperfd = fd[1]; sa.sa_flags = 0; sa.sa_handler = cleanup_handler; sigaction(SIGINT, &sa, nil); @@ -507,6 +509,9 @@ main(int argc, char *argv[]) { cleanup(); XCloseDisplay(blz.dpy); ixp_server_close(&srv); + close(sleeperfd); + if(execstr) + execl("/bin/sh", "sh", "-c", execstr, nil); if(errstr) return 1; return 0; diff --git a/wmii.h b/wmii.h @@ -269,6 +269,7 @@ void (*handler[LASTEvent]) (XEvent *); /* Misc */ Bool starting; Bool verbose; +char *execstr; /* wm.c */ char *message_root(char *message);