summaryrefslogtreecommitdiffhomepage
path: root/patch/killunsel.c
diff options
context:
space:
mode:
Diffstat (limited to 'patch/killunsel.c')
-rw-r--r--patch/killunsel.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/patch/killunsel.c b/patch/killunsel.c
new file mode 100644
index 0000000..9e06d53
--- /dev/null
+++ b/patch/killunsel.c
@@ -0,0 +1,22 @@
+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);
+ }
+ }
+ }
+} \ No newline at end of file