[wiki] [sites] dwm: Add killunsel patch || Chris Down

From: <git_AT_suckless.org>
Date: Fri, 28 Jul 2017 18:03:00 +0200

commit 73f6c829bb7367a39ab37a4ba0c97322f18ade10
Author: Chris Down <chris_AT_chrisdown.name>
Date: Fri Jul 28 17:02:24 2017 +0100

    dwm: Add killunsel patch

diff --git a/dwm.suckless.org/patches/dwm-killunsel-ceac8c91ff.diff b/dwm.suckless.org/patches/dwm-killunsel-ceac8c91ff.diff
new file mode 100644
index 00000000..f618cf90
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-killunsel-ceac8c91ff.diff
_AT_@ -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
+_AT_@ -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
+_AT_@ -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);
+_AT_@ -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
new file mode 100644
index 00000000..ab070628
--- /dev/null
+++ b/dwm.suckless.org/patches/killunsel.md
_AT_@ -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_AT_chrisdown.name>
diff --git a/suckless.org/people/cdown.md b/suckless.org/people/cdown.md
index d59c420d..a35ee4da 100644
--- a/suckless.org/people/cdown.md
+++ b/suckless.org/people/cdown.md
_AT_@ -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).
Received on Fri Jul 28 2017 - 18:03:00 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 28 2017 - 18:12:41 CEST