commit 73f6c829bb7367a39ab37a4ba0c97322f18ade10
parent 9afcd97bab4b5339f7bbd4bafb332792b9683b90
Author: Chris Down <chris@chrisdown.name>
Date: Fri, 28 Jul 2017 17:02:24 +0100
dwm: Add killunsel patch
Diffstat:
3 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/dwm-killunsel-ceac8c91ff.diff b/dwm.suckless.org/patches/dwm-killunsel-ceac8c91ff.diff
@@ -0,0 +1,54 @@
+diff --git a/config.def.h b/config.def.h
+index a9ac303..6496426 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -73,6 +73,7 @@ static Key keys[] = {
+ { MODKEY, XK_Return, zoom, {0} },
+ { MODKEY, XK_Tab, view, {0} },
+ { MODKEY|ShiftMask, XK_c, killclient, {0} },
++ { MODKEY|ShiftMask, XK_x, killunsel, {0} },
+ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
+ { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
+ { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
+diff --git a/dwm.c b/dwm.c
+index a5ce993..a310c29 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -178,6 +178,7 @@ static void grabkeys(void);
+ static void incnmaster(const Arg *arg);
+ static void keypress(XEvent *e);
+ static void killclient(const Arg *arg);
++static void killunsel(const Arg *arg);
+ static void manage(Window w, XWindowAttributes *wa);
+ static void mappingnotify(XEvent *e);
+ static void maprequest(XEvent *e);
+@@ -1017,6 +1018,29 @@ killclient(const Arg *arg)
+ }
+
+ void
++killunsel(const Arg *arg)
++{
++ Client *i = NULL;
++
++ if (!selmon->sel)
++ return;
++
++ for (i = selmon->clients; i; i = i->next) {
++ if (ISVISIBLE(i) && i != selmon->sel) {
++ if (!sendevent(i, wmatom[WMDelete])) {
++ XGrabServer(dpy);
++ XSetErrorHandler(xerrordummy);
++ XSetCloseDownMode(dpy, DestroyAll);
++ XKillClient(dpy, i->win);
++ XSync(dpy, False);
++ XSetErrorHandler(xerror);
++ XUngrabServer(dpy);
++ }
++ }
++ }
++}
++
++void
+ manage(Window w, XWindowAttributes *wa)
+ {
+ Client *c, *t = NULL;
diff --git a/dwm.suckless.org/patches/killunsel.md b/dwm.suckless.org/patches/killunsel.md
@@ -0,0 +1,23 @@
+killunsel
+=========
+
+Description
+-----------
+
+Kills all visible clients that are unselected. That is, after running
+`killunsel`, only the selected client will remain. The rest will not only be
+not visible, but they will have been killed.
+
+This is essentially equivalent in idea to :tabonly (albeit per-client, not
+per-"tab") in vim.
+
+Download
+--------
+
+* [dwm-killunsel-ceac8c91ff.diff](dwm-killunsel-ceac8c91ff.diff) (1.7k)
+ (20170728)
+
+Author
+------
+
+* [Chris Down](https://chrisdown.name) (cdown) <chris@chrisdown.name>
diff --git a/suckless.org/people/cdown.md b/suckless.org/people/cdown.md
@@ -8,6 +8,7 @@ stuff for dmenu, although I'm not as active in the community as I used to be.
- [attachaside (unfocused tag version)](http://dwm.suckless.org/patches/attachaside)
- [center](http://dwm.suckless.org/patches/center)
- [ispermanent](http://dwm.suckless.org/patches/ispermanent)
+- [killunsel](http://dwm.suckless.org/patches/killunsel)
Most of my projects are hosted on [my Github](https://github.com/cdown), or on
[my website](https://chrisdown.name).