[hackers] [tabbed] add -k to close tabbed foreground client on WMDelete || Justin Keogh

From: <git_AT_suckless.org>
Date: Fri, 25 Mar 2016 07:42:00 +0100 (CET)

commit 95b46cd3a92cab0a9b18cabb911e11f7300c0e1a
Author: Justin Keogh <suckless_AT_v6y.net>
AuthorDate: Mon Mar 21 02:16:12 2016 +0000
Commit: Christoph Lohmann <20h_AT_r-36.net>
CommitDate: Fri Mar 25 07:41:43 2016 +0100

    add -k to close tabbed foreground client on WMDelete
    
    Hello, this is useful when you want to use the same key binding that closes windows to close tabs. I got tired of loosing my tabbed/surf session when I hit my WM's close key. "Last tab" behavior still respects -c/-f.
    
    Cheers
    -J
    
    From 829e95855f0fe78a368788a5e72231bd6456a8cf Mon Sep 17 00:00:00 2001
    From: jakeogh <github.com_AT_v6y.net>
    Date: Mon, 21 Mar 2016 01:36:28 +0000
    Subject: [PATCH] add -k to close foreground tabbed client on WM_DELETE_WINDOW
    
    Signed-off-by: Christoph Lohmann <20h_AT_r-36.net>

diff --git a/tabbed.c b/tabbed.c
index a9050ae..9a44795 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -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];
_AT_@ -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
_AT_@ -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);
 }
_AT_@ -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;
Received on Fri Mar 25 2016 - 07:42:00 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 25 2016 - 07:48:14 CET