Add the -f flag, which tells tabbed to run the given command again, in case

the last tab is closed.
This commit is contained in:
Christoph Lohmann 2012-11-26 14:55:26 +01:00
parent cc1b72371a
commit 5e1c53ad3c
2 changed files with 17 additions and 3 deletions

View File

@ -24,6 +24,10 @@ tabbed will just print its xid and run no command.
.B \-d .B \-d
detaches tabbed from the terminal and prints its XID to stdout. detaches tabbed from the terminal and prints its XID to stdout.
.TP .TP
.B \-f
fill up tabbed again by spawning the provided command, when the last tab is
closed.
.TP
.B \-h .B \-h
will print the usage of tabbed. will print the usage of tabbed.
.TP .TP

View File

@ -145,7 +145,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
}; };
static int bh, wx, wy, ww, wh; static int bh, wx, wy, ww, wh;
static unsigned int numlockmask = 0; static unsigned int numlockmask = 0;
static Bool running = True, nextfocus, doinitspawn = True; static Bool running = True, nextfocus, doinitspawn = True, fillagain = False;
static Display *dpy; static Display *dpy;
static DC dc; static DC dc;
static Atom wmatom[WMLast]; static Atom wmatom[WMLast];
@ -954,6 +954,11 @@ unmanage(int c) {
focus(lastsel); focus(lastsel);
} }
if(nclients == 0) {
if(fillagain)
spawn(NULL);
}
drawbar(); drawbar();
XSync(dpy, False); XSync(dpy, False);
} }
@ -1023,7 +1028,7 @@ char *argv0;
void void
usage(void) { usage(void) {
die("usage: %s [-dhsv] [-n name] [-r narg] command...\n", argv0); die("usage: %s [-dfhsv] [-n name] [-r narg] command...\n", argv0);
} }
int int
@ -1034,6 +1039,9 @@ main(int argc, char *argv[]) {
case 'd': case 'd':
detach = 1; detach = 1;
break; break;
case 'f':
fillagain = 1;
break;
case 'n': case 'n':
wmname = EARGF(usage()); wmname = EARGF(usage());
break; break;
@ -1052,8 +1060,10 @@ main(int argc, char *argv[]) {
usage(); usage();
} ARGEND; } ARGEND;
if(argc < 1) if(argc < 1) {
doinitspawn = False; doinitspawn = False;
fillagain = False;
}
setcmd(argc, argv, replace); setcmd(argc, argv, replace);