about summary refs log tree commit diff stats
diff options
context:
space:
mode:
author2016-03-21 02:16:12 +0000
committer2016-03-25 07:41:43 +0100
commit95b46cd3a92cab0a9b18cabb911e11f7300c0e1a (patch)
treedf580e42aec8b3f53f425e9e0ead87cfe3beda3c
parent4ccaba49681008900bacfd1eec23571d9b488619 (diff)
downloadtabbed-95b46cd3a92cab0a9b18cabb911e11f7300c0e1a.tar.gz
-rw-r--r--tabbed.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/tabbed.c b/tabbed.c
index a9050ae..9a44795 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -155,7 +155,8 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
 static int bh, wx, wy, ww, wh;
 static unsigned int numlockmask;
 static Bool running = True, nextfocus, doinitspawn = True,
-            fillagain = False, closelastclient = False;
+            fillagain = False, closelastclient = False,
+            killclientsfirst = False;
 static Display *dpy;
 static DC dc;
 static Atom wmatom[WMLast];
@@ -236,8 +237,13 @@ clientmessage(const XEvent *e)
 	const XClientMessageEvent *ev = &e->xclient;
 
 	if (ev->message_type == wmatom[WMProtocols] &&
-	    ev->data.l[0] == wmatom[WMDelete])
+	    ev->data.l[0] == wmatom[WMDelete]) {
+		if (nclients > 1 && killclientsfirst) {
+			killclient(0);
+			return;
+		}
 		running = False;
+	}
 }
 
 void
@@ -1247,7 +1253,7 @@ xsettitle(Window w, const char *str)
 void
 usage(void)
 {
-	die("usage: %s [-dfsv] [-g geometry] [-n name] [-p [s+/-]pos]\n"
+	die("usage: %s [-dfksv] [-g geometry] [-n name] [-p [s+/-]pos]\n"
 	    "       [-r narg] [-o color] [-O color] [-t color] [-T color]\n"
 	    "       [-u color] [-U color] command...\n", argv0);
 }
@@ -1273,6 +1279,9 @@ main(int argc, char *argv[])
 	case 'g':
 		geometry = EARGF(usage());
 		break;
+	case 'k':
+		killclientsfirst = True;
+		break;
 	case 'n':
 		wmname = EARGF(usage());
 		break;