[hackers] [tabbed] Add the -f flag, which tells tabbed to run the given command again, in case || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Mon, 26 Nov 2012 14:57:21 +0100 (CET)

changeset: 182:c72bc3b6376c
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Mon Nov 26 14:55:26 2012 +0100
files: tabbed.1 tabbed.c
description:
Add the -f flag, which tells tabbed to run the given command again, in case
the last tab is closed.


diff -r e2cd3f3b62cc -r c72bc3b6376c tabbed.1
--- a/tabbed.1 Sun Nov 25 23:04:22 2012 +0100
+++ b/tabbed.1 Mon Nov 26 14:55:26 2012 +0100
_AT_@ -24,6 +24,10 @@
 .B \-d
 detaches tabbed from the terminal and prints its XID to stdout.
 .TP
+.B \-f
+fill up tabbed again by spawning the provided command, when the last tab is
+closed.
+.TP
 .B \-h
 will print the usage of tabbed.
 .TP
diff -r e2cd3f3b62cc -r c72bc3b6376c tabbed.c
--- a/tabbed.c Sun Nov 25 23:04:22 2012 +0100
+++ b/tabbed.c Mon Nov 26 14:55:26 2012 +0100
_AT_@ -145,7 +145,7 @@
 };
 static int bh, wx, wy, ww, wh;
 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 DC dc;
 static Atom wmatom[WMLast];
_AT_@ -954,6 +954,11 @@
                 focus(lastsel);
         }
 
+ if(nclients == 0) {
+ if(fillagain)
+ spawn(NULL);
+ }
+
         drawbar();
         XSync(dpy, False);
 }
_AT_@ -1023,7 +1028,7 @@
 
 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
_AT_@ -1034,6 +1039,9 @@
         case 'd':
                 detach = 1;
                 break;
+ case 'f':
+ fillagain = 1;
+ break;
         case 'n':
                 wmname = EARGF(usage());
                 break;
_AT_@ -1052,8 +1060,10 @@
                 usage();
         } ARGEND;
 
- if(argc < 1)
+ if(argc < 1) {
                 doinitspawn = False;
+ fillagain = False;
+ }
 
         setcmd(argc, argv, replace);
 
Received on Mon Nov 26 2012 - 14:57:21 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 26 2012 - 15:00:09 CET