summaryrefslogtreecommitdiff
path: root/tabbed.c
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2012-02-09 17:39:33 +0100
committerChristoph Lohmann <20h@r-36.net>2012-02-09 17:39:33 +0100
commitc79e3392413da488eecb2769473989d0c2c861c9 (patch)
tree1788d8acb8d521e730186a472df87a81176ac0dd /tabbed.c
parent3d12c416b82e4dd0b41d627752a165cbfb96d59a (diff)
Allow no automatic spawning of the command.
Diffstat (limited to 'tabbed.c')
-rw-r--r--tabbed.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/tabbed.c b/tabbed.c
index b3c3c12..fbd2221 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -141,7 +141,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
};
static int bh, wx, wy, ww, wh;
static unsigned int numlockmask = 0;
-static Bool running = True, nextfocus;
+static Bool running = True, nextfocus, doinitspawn = True;
static Display *dpy;
static DC dc;
static Atom wmatom[WMLast], xembedatom;
@@ -687,7 +687,8 @@ run(void) {
/* main event loop */
XSync(dpy, False);
drawbar();
- spawn(NULL);
+ if(doinitspawn == True)
+ spawn(NULL);
while(running) {
XNextEvent(dpy, &ev);
if(handler[ev.type])
@@ -862,6 +863,12 @@ xerror(Display *dpy, XErrorEvent *ee) {
return xerrorxlib(dpy, ee); /* may call exit */
}
+void
+usage(char *argv0)
+{
+ die("usage: %s [-dhsv] command...\n", argv0);
+}
+
int
main(int argc, char *argv[]) {
int i, detach = 0;
@@ -871,11 +878,15 @@ main(int argc, char *argv[]) {
die("tabbed-"VERSION", © 2009-2011 tabbed engineers, see LICENSE for details\n");
else if(!strcmp("-d", argv[i]))
detach = 1;
+ else if(!strcmp("-s", argv[i]))
+ doinitspawn = False;
+ else if(!strcmp("-h", argv[i]))
+ usage(argv[0]);
else
setcmd(argc-i, argv+i);
}
if(!cmd)
- die("usage: tabbed [-d] [-v] command...\n");
+ usage(argv[0]);
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fprintf(stderr, "tabbed: no locale support\n");
if(!(dpy = XOpenDisplay(NULL)))