aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-12 00:58:38 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-12 00:59:29 -0500
commitbc9049a11b9bb667e2161d8e237ca01b3d0d98f1 (patch)
tree9974bf390cabc567ce472f4935c3a50dbdfdf356 /dwl.c
parentc82c000bd413579237f5292d8076f045726efe15 (diff)
add spawn and termcmd
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index 627f968..3f74b8b 100644
--- a/dwl.c
+++ b/dwl.c
@@ -125,6 +125,7 @@ static void focusnext(struct dwl_server *, const Arg *);
static void movemouse(struct dwl_server *, const Arg *);
static void quit(struct dwl_server *, const Arg *);
static void resizemouse(struct dwl_server *, const Arg *);
+static void spawn(struct dwl_server *, const Arg *);
#include "config.h"
@@ -187,6 +188,16 @@ static void quit(struct dwl_server *server, const Arg *unused) {
wl_display_terminate(server->wl_display);
}
+static void spawn(struct dwl_server *server, const Arg *arg) {
+ if (fork() == 0) {
+ setsid();
+ execvp(((char **)arg->v)[0], (char **)arg->v);
+ fprintf(stderr, "dwl: execvp %s", ((char **)arg->v)[0]);
+ perror(" failed");
+ exit(EXIT_FAILURE);
+ }
+}
+
static void focusnext(struct dwl_server *server, const Arg *unused) {
/* Cycle to the next view */
if (wl_list_length(&server->views) < 2) {